mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
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:
parent
6de62a1468
commit
b63e64ee9f
3 changed files with 60 additions and 16 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue