From 8e108d21233179259718ae7e3d29c4c121cd2aac Mon Sep 17 00:00:00 2001 From: Maya Sigal Date: Mon, 1 Aug 2022 16:58:31 +0300 Subject: [PATCH] fix --- api/filters/check_blocked_clients_filter.go | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/api/filters/check_blocked_clients_filter.go b/api/filters/check_blocked_clients_filter.go index 22aa34a06..d31e0b331 100644 --- a/api/filters/check_blocked_clients_filter.go +++ b/api/filters/check_blocked_clients_filter.go @@ -81,8 +81,13 @@ func getPayload(data string) (*types.BlockedClient, error) { return payload, nil } -func (b *BlockedClientsFilter) initializeBlockedClients() (err error) { +func (b *BlockedClientsFilter) initializeBlockedClients() error { b.connectDBForBlockedClientsEvent() + err := b.getBlockedClientsList() + return err +} + +func (b *BlockedClientsFilter) getBlockedClientsList() error { blockedClientsList, err := b.repository.List(b.ctx, types.BlockedClientsType) if err != nil { return err @@ -92,19 +97,6 @@ func (b *BlockedClientsFilter) initializeBlockedClients() (err error) { b.cache.Store(blockedClient.ClientID, blockedClient) } return nil -} - -func getBlockedClientsList(repository storage.Repository) func(ctx context.Context) []*types.BlockedClient { - return func(ctx context.Context) []*types.BlockedClient { - clientsList, err := repository.List(ctx, types.BlockedClientsType) - if err != nil { - return nil - } - - blockedClients := clientsList.(*types.BlockedClients).BlockedClients - return blockedClients - - } }