elector & locker were failing to send out when not leader (#688)

* elector & locker were failing to send out when not leader

* update test to confirm non-active elector/locker are checked

* clean up data race

* try to make test more reliable
This commit is contained in:
John Roesler
2024-03-12 08:37:11 -05:00
committed by GitHub
parent c2f95759d2
commit ebec5e9f91
5 changed files with 142 additions and 26 deletions
+8 -8
View File
@@ -516,7 +516,7 @@ func ExampleWithClock() {
}
func ExampleWithDistributedElector() {
//var _ Elector = (*myElector)(nil)
//var _ gocron.Elector = (*myElector)(nil)
//
//type myElector struct{}
//
@@ -524,15 +524,15 @@ func ExampleWithDistributedElector() {
// return nil
//}
//
//elector := myElector{}
//elector := &myElector{}
//
//_, _ = NewScheduler(
// WithDistributedElector(elector),
//_, _ = gocron.NewScheduler(
// gocron.WithDistributedElector(elector),
//)
}
func ExampleWithDistributedLocker() {
//var _ Locker = (*myLocker)(nil)
//var _ gocron.Locker = (*myLocker)(nil)
//
//type myLocker struct{}
//
@@ -549,10 +549,10 @@ func ExampleWithDistributedLocker() {
// return nil
//}
//
//locker := myLocker{}
//locker := &myLocker{}
//
//_, _ = NewScheduler(
// WithDistributedLocker(locker),
//_, _ = gocron.NewScheduler(
// gocron.WithDistributedLocker(locker),
//)
}