Fix locking logic for HA + add list unsubscribe for PAPI (#2904)

* add list unsubscribe operation for papi

* fix the locking logic for HA
This commit is contained in:
Thibault "bui" Koechlin 2024-03-19 10:29:16 +01:00 committed by GitHub
parent 6de62a1468
commit b63e64ee9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 60 additions and 16 deletions

View file

@ -639,6 +639,14 @@ func (a *apic) PullTop(forcePull bool) error {
return nil
}
/*defer lock release*/
defer func() {
log.Debug("Releasing lock for pullCAPI")
if err := a.dbClient.ReleasePullCAPILock(); err != nil {
log.Errorf("while releasing lock: %v", err)
}
}()
log.Infof("Starting community-blocklist update")
data, _, err := a.apiClient.Decisions.GetStreamV3(context.Background(), apiclient.DecisionsStreamOpts{Startup: a.startup})
@ -690,11 +698,6 @@ func (a *apic) PullTop(forcePull bool) error {
return fmt.Errorf("while updating blocklists: %w", err)
}
log.Debug("Releasing lock for pullCAPI")
if err := a.dbClient.ReleasePullCAPILock(); err != nil {
return fmt.Errorf("while releasing lock: %w", err)
}
return nil
}