Change store All to use channel

This commit is contained in:
2022-08-26 12:21:52 +02:00
parent 4c77b5ef9b
commit 07fe16b72a
6 changed files with 52 additions and 22 deletions

View File

@@ -8,6 +8,8 @@ import (
"github.com/prometheus/client_golang/prometheus"
)
var _ LoginAttemptStore = &MetricsCollectingStore{}
const tickDuration = 5 * time.Second
type MetricsCollectingStore struct {
@@ -89,7 +91,7 @@ func (s *MetricsCollectingStore) AddAttempt(l *models.LoginAttempt) error {
return err
}
func (s *MetricsCollectingStore) All() ([]models.LoginAttempt, error) {
func (s *MetricsCollectingStore) All() (<-chan models.LoginAttempt, error) {
return s.store.All()
}