Update sync interval seconds field. (#1698)

* Update sync interval seconds field.

* If the sync interval was updated, schedule the next sync job wakeup immediately.

* Calculate the next sync time for the scheduler should wake up if we only updated the sync interval.
This commit is contained in:
Todd authored and GitHub committed 2021-11-12 14:55:22 -07:00
1 parent 228be58cc8
commit 5d2b0e94aa
4 files changed
+69 -1

No files matched your search

@@ -1521,6 +1521,11 @@ func TestUpdate_Plugin(t *testing.T) {
c.PreferredEndpoints = i
}
}
updateSyncInterval := func(i *wrapperspb.Int32Value) updateFn {
return func(c *pb.HostSet) {
c.SyncIntervalSeconds = i
}
}
updateAttrs := func(i *structpb.Struct) updateFn {
return func(c *pb.HostSet) {
c.Attributes = i
@@ -1576,6 +1581,17 @@ func TestUpdate_Plugin(t *testing.T) {
assert.Equal(t, in.PreferredEndpoints, []string{"dns:new"})
},
},
{
name: "Update sync interval",
masks: []string{"sync_interval_seconds"},
changes: []updateFn{
clearReadOnlyFields(),
updateSyncInterval(wrapperspb.Int32(42)),
},
check: func(t *testing.T, in *pb.HostSet) {
assert.Equal(t, in.SyncIntervalSeconds, wrapperspb.Int32(42))
},
},
{
name: "Don't update preferred_endpoints",
masks: []string{"name"},