1
0
forked from extern/smegmesh
smegmesh/pkg/sync/syncscheduler.go

19 lines
437 B
Go
Raw Normal View History

2023-10-10 21:14:40 +02:00
package sync
import (
"github.com/tim-beatham/wgmesh/pkg/ctrlserver"
"github.com/tim-beatham/wgmesh/pkg/lib"
2023-10-10 21:14:40 +02:00
)
// Run implements SyncScheduler.
func syncFunction(syncer Syncer) lib.TimerFunc {
return func() error {
syncer.SyncMeshes()
return nil
2023-10-10 21:14:40 +02:00
}
}
func NewSyncScheduler(s *ctrlserver.MeshCtrlServer, syncRequester SyncRequester, syncer Syncer) *lib.Timer {
return lib.NewTimer(syncFunction(syncer), int(s.Conf.SyncRate))
2023-10-10 21:14:40 +02:00
}