From 1e94d71261e42e96a63a3b828901ddbd1965f522 Mon Sep 17 00:00:00 2001 From: David Florness Date: Sat, 12 Mar 2022 14:26:55 -0500 Subject: [PATCH] Log sync errors and decrease the sleep duration from 10 seconds [0] to 5 seconds. [0]: https://github.com/mautrix/go/blob/v0.10.8/sync.go#L228 --- cmd/tallyard/syncer.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 cmd/tallyard/syncer.go diff --git a/cmd/tallyard/syncer.go b/cmd/tallyard/syncer.go new file mode 100644 index 0000000..58e016a --- /dev/null +++ b/cmd/tallyard/syncer.go @@ -0,0 +1,18 @@ +package main + +import ( + "time" + + log "github.com/sirupsen/logrus" + "maunium.net/go/mautrix" +) + +type TallyardSyncer struct { + *mautrix.DefaultSyncer +} + +func (s *TallyardSyncer) OnFailedSync(res *mautrix.RespSync, err error) (time.Duration, error) { + sleepDuration := 5 * time.Second + log.Warnf("encountered sync error; retrying in %s: %s", sleepDuration, err) + return sleepDuration, nil +} -- 2.38.4