mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-29 20:23:01 +02:00
yangerd: Send sighup to yangerd on config change
This is to force yangerd to repoll polled things
This commit is contained in:
@@ -674,6 +674,15 @@ static int change_cb(sr_session_ctx_t *session, uint32_t sub_id, const char *mod
|
||||
return SR_ERR_SYS;
|
||||
}
|
||||
|
||||
/*
|
||||
Send sighup to yangerd to trigger a poll of polled values.
|
||||
This will make sure that there is no stale data.
|
||||
*/
|
||||
if (systemf("initctl -b reload yangerd")) {
|
||||
EMERG("Failed reloading yangerd");
|
||||
return SR_ERR_SYS;
|
||||
}
|
||||
|
||||
AUDIT("The new configuration has been applied.");
|
||||
}
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ type Collector interface {
|
||||
// RunAll starts one goroutine per Collector, each ticking at the
|
||||
// collector's configured interval. A failed Collect is logged and
|
||||
// retried on the next tick. All goroutines exit when ctx is cancelled.
|
||||
func RunAll(ctx context.Context, wg *sync.WaitGroup, t *tree.Tree, collectors []Collector) {
|
||||
func RunAll(ctx context.Context, wg *sync.WaitGroup, t *tree.Tree, collectors []Collector, pokeCh <-chan struct{}) {
|
||||
for _, c := range collectors {
|
||||
wg.Add(1)
|
||||
go runOne(ctx, wg, t, c)
|
||||
go runOne(ctx, wg, t, c, pokeCh)
|
||||
}
|
||||
}
|
||||
|
||||
func runOne(ctx context.Context, wg *sync.WaitGroup, t *tree.Tree, c Collector) {
|
||||
func runOne(ctx context.Context, wg *sync.WaitGroup, t *tree.Tree, c Collector, pokeCh <-chan struct{}) {
|
||||
defer wg.Done()
|
||||
|
||||
if err := c.Collect(ctx, t); err != nil {
|
||||
@@ -46,6 +46,10 @@ func runOne(ctx context.Context, wg *sync.WaitGroup, t *tree.Tree, c Collector)
|
||||
if err := c.Collect(ctx, t); err != nil {
|
||||
log.Printf("collector %s: %v", c.Name(), err)
|
||||
}
|
||||
case <-pokeCh:
|
||||
if err := c.Collect(ctx, t); err != nil {
|
||||
log.Printf("collector %s: poke: %v", c.Name(), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user