-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
morph: support reloading morph endpoints with SIGHUP
Add a new function `Client.Reload` that passes the `WithEndpoints` option and updates the `Client` endpoints. Add docs. Closes #1871. Signed-off-by: Andrey Butusov <andrey@nspcc.io>
- Loading branch information
Showing
6 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package client | ||
|
||
// Reload allows runtime reconfiguration for WithEndpoints parameter. | ||
func (c *Client) Reload(opts ...Option) { | ||
cfg := new(cfg) | ||
for _, o := range opts { | ||
o(cfg) | ||
} | ||
|
||
c.cfg.endpointsLock.Lock() | ||
|
||
c.cfg.endpoints = cfg.endpoints | ||
|
||
c.cfg.endpointsLock.Unlock() | ||
} |