Update Context for store
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package syncer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gemini-balancer/internal/store"
|
||||
"log"
|
||||
@@ -51,7 +52,7 @@ func (s *CacheSyncer[T]) Get() T {
|
||||
|
||||
func (s *CacheSyncer[T]) Invalidate() error {
|
||||
log.Printf("INFO: Publishing invalidation notification on channel '%s'", s.channelName)
|
||||
return s.store.Publish(s.channelName, []byte("reload"))
|
||||
return s.store.Publish(context.Background(), s.channelName, []byte("reload"))
|
||||
}
|
||||
|
||||
func (s *CacheSyncer[T]) Stop() {
|
||||
@@ -84,7 +85,7 @@ func (s *CacheSyncer[T]) listenForUpdates() {
|
||||
default:
|
||||
}
|
||||
|
||||
subscription, err := s.store.Subscribe(s.channelName)
|
||||
subscription, err := s.store.Subscribe(context.Background(), s.channelName)
|
||||
if err != nil {
|
||||
log.Printf("ERROR: Failed to subscribe to '%s', retrying in 5s: %v", s.channelName, err)
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
Reference in New Issue
Block a user