Run make store-layers
Этот коммит содержится в:
@@ -12462,6 +12462,24 @@ func (s *OpenTracingLayerWebhookStore) GetIncomingListByUser(userID string, offs
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerWebhookStore) GetIncomingTotal() (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "WebhookStore.GetIncomingTotal")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
defer func() {
|
||||
s.Root.Store.SetContext(origCtx)
|
||||
}()
|
||||
|
||||
defer span.Finish()
|
||||
result, err := s.WebhookStore.GetIncomingTotal()
|
||||
if err != nil {
|
||||
span.LogFields(spanlog.Error(err))
|
||||
ext.Error.Set(span, true)
|
||||
}
|
||||
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerWebhookStore) GetOutgoing(id string) (*model.OutgoingWebhook, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "WebhookStore.GetOutgoing")
|
||||
@@ -12588,6 +12606,24 @@ func (s *OpenTracingLayerWebhookStore) GetOutgoingListByUser(userID string, offs
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerWebhookStore) GetOutgoingTotal() (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "WebhookStore.GetOutgoingTotal")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
defer func() {
|
||||
s.Root.Store.SetContext(origCtx)
|
||||
}()
|
||||
|
||||
defer span.Finish()
|
||||
result, err := s.WebhookStore.GetOutgoingTotal()
|
||||
if err != nil {
|
||||
span.LogFields(spanlog.Error(err))
|
||||
ext.Error.Set(span, true)
|
||||
}
|
||||
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerWebhookStore) InvalidateWebhookCache(webhook string) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "WebhookStore.InvalidateWebhookCache")
|
||||
|
||||
@@ -14211,6 +14211,27 @@ func (s *RetryLayerWebhookStore) GetIncomingListByUser(userID string, offset int
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerWebhookStore) GetIncomingTotal() (int64, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.WebhookStore.GetIncomingTotal()
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
timepkg.Sleep(100 * timepkg.Millisecond)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerWebhookStore) GetOutgoing(id string) (*model.OutgoingWebhook, error) {
|
||||
|
||||
tries := 0
|
||||
@@ -14358,6 +14379,27 @@ func (s *RetryLayerWebhookStore) GetOutgoingListByUser(userID string, offset int
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerWebhookStore) GetOutgoingTotal() (int64, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.WebhookStore.GetOutgoingTotal()
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
timepkg.Sleep(100 * timepkg.Millisecond)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerWebhookStore) InvalidateWebhookCache(webhook string) {
|
||||
|
||||
s.WebhookStore.InvalidateWebhookCache(webhook)
|
||||
|
||||
@@ -11224,6 +11224,22 @@ func (s *TimerLayerWebhookStore) GetIncomingListByUser(userID string, offset int
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerWebhookStore) GetIncomingTotal() (int64, error) {
|
||||
start := time.Now()
|
||||
|
||||
result, err := s.WebhookStore.GetIncomingTotal()
|
||||
|
||||
elapsed := float64(time.Since(start)) / float64(time.Second)
|
||||
if s.Root.Metrics != nil {
|
||||
success := "false"
|
||||
if err == nil {
|
||||
success = "true"
|
||||
}
|
||||
s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetIncomingTotal", success, elapsed)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerWebhookStore) GetOutgoing(id string) (*model.OutgoingWebhook, error) {
|
||||
start := time.Now()
|
||||
|
||||
@@ -11336,6 +11352,22 @@ func (s *TimerLayerWebhookStore) GetOutgoingListByUser(userID string, offset int
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerWebhookStore) GetOutgoingTotal() (int64, error) {
|
||||
start := time.Now()
|
||||
|
||||
result, err := s.WebhookStore.GetOutgoingTotal()
|
||||
|
||||
elapsed := float64(time.Since(start)) / float64(time.Second)
|
||||
if s.Root.Metrics != nil {
|
||||
success := "false"
|
||||
if err == nil {
|
||||
success = "true"
|
||||
}
|
||||
s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetOutgoingTotal", success, elapsed)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerWebhookStore) InvalidateWebhookCache(webhook string) {
|
||||
start := time.Now()
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user