summaryrefslogtreecommitdiffstats
path: root/store/sqlstore/webhook_store.go
diff options
context:
space:
mode:
Diffstat (limited to 'store/sqlstore/webhook_store.go')
-rw-r--r--store/sqlstore/webhook_store.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/store/sqlstore/webhook_store.go b/store/sqlstore/webhook_store.go
index 8a3720fa0..45ad90e52 100644
--- a/store/sqlstore/webhook_store.go
+++ b/store/sqlstore/webhook_store.go
@@ -26,8 +26,12 @@ const (
var webhookCache = utils.NewLru(WEBHOOK_CACHE_SIZE)
-func ClearWebhookCaches() {
+func (s SqlWebhookStore) ClearCaches() {
webhookCache.Purge()
+
+ if s.metrics != nil {
+ s.metrics.IncrementMemCacheInvalidationCounter("Webhook - Purge")
+ }
}
func NewSqlWebhookStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.WebhookStore {
@@ -78,6 +82,9 @@ func (s SqlWebhookStore) CreateIndexesIfNotExists() {
func (s SqlWebhookStore) InvalidateWebhookCache(webhookId string) {
webhookCache.Remove(webhookId)
+ if s.metrics != nil {
+ s.metrics.IncrementMemCacheInvalidationCounter("Webhook - Remove by WebhookId")
+ }
}
func (s SqlWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) store.StoreChannel {
@@ -164,7 +171,7 @@ func (s SqlWebhookStore) PermanentDeleteIncomingByUser(userId string) store.Stor
result.Err = model.NewAppError("SqlWebhookStore.DeleteIncomingByUser", "store.sql_webhooks.permanent_delete_incoming_by_user.app_error", nil, "id="+userId+", err="+err.Error(), http.StatusInternalServerError)
}
- ClearWebhookCaches()
+ s.ClearCaches()
})
}
@@ -175,7 +182,7 @@ func (s SqlWebhookStore) PermanentDeleteIncomingByChannel(channelId string) stor
result.Err = model.NewAppError("SqlWebhookStore.DeleteIncomingByChannel", "store.sql_webhooks.permanent_delete_incoming_by_channel.app_error", nil, "id="+channelId+", err="+err.Error(), http.StatusInternalServerError)
}
- ClearWebhookCaches()
+ s.ClearCaches()
})
}
@@ -322,7 +329,7 @@ func (s SqlWebhookStore) PermanentDeleteOutgoingByChannel(channelId string) stor
result.Err = model.NewAppError("SqlWebhookStore.DeleteOutgoingByChannel", "store.sql_webhooks.permanent_delete_outgoing_by_channel.app_error", nil, "id="+channelId+", err="+err.Error(), http.StatusInternalServerError)
}
- ClearWebhookCaches()
+ s.ClearCaches()
})
}