Add sync interval to host sets (#1680)

This adds a parameter to host sets allowing the sync interval to be
user-specified on a per-host-set basis. A value of -1 disables syncing;
a value of null uses the current default.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-11-11 11:28:08 -05:00
1 parent dba7c6b531
commit 30e9f944a2
27 files changed
+752 -231

No files matched your search

+20 -2
View File
@@ -19,10 +19,28 @@ delete from host_plugin_catalog_secret
setSyncNextRunInQuery = `
select
need_sync as sync_now,
extract(epoch from (least(now(), last_sync_time) + ?) - now())::int as resync_in
need_sync as sync_now,
sync_interval_seconds,
case
when sync_interval_seconds is null
then
extract(epoch from (least(now(), last_sync_time) + ?) - now())::int
when sync_interval_seconds > 0
then
extract(epoch from (least(now(), last_sync_time)) - now())::int + sync_interval_seconds
else
0
end resync_in
from host_plugin_set
order by need_sync desc, last_sync_time desc
limit 1;
`
setSyncJobQuery = `
need_sync
or
sync_interval_seconds is null and last_sync_time <= wt_add_seconds_to_now(?)
or
sync_interval_seconds > 0 and wt_add_seconds(sync_interval_seconds, last_sync_time) <= current_timestamp
`
)