Skip to content

Commit

Permalink
chore: Set expiry for submission set by header key
Browse files Browse the repository at this point in the history
  • Loading branch information
anomit committed Sep 4, 2024
1 parent 03a0b9b commit f6d1050
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkgs/dequeuer/submissionHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,15 @@ func (s *SubmissionHandler) verifyAndStoreSubmission(details SubmissionDetails)

log.Debugf("Successfully set submission with set %s and key %s", set, key)

// expire submissions set by header key
if err := redis.RedisClient.Expire(context.Background(), set, 30*time.Minute).Err(); err != nil {
log.Errorf("Failed to set expiry for submission set by header key: %v", err)
// send notification
reporting.SendFailureNotification("verifyAndStoreSubmission", fmt.Sprintf("Failed to set expiry for submission set by header key: %v", err), time.Now().String(), "High")
return fmt.Errorf("redis client failure: %s", err.Error())
}

// Store increment submission count for this epoch
// TODO: This can be a redis failure, that is critical but need to evaluate next steps - ideally just report and move on
err = redis.RedisClient.Incr(context.Background(), redis.EpochSubmissionsCount(details.submission.Request.EpochId)).Err()
if err != nil {
reporting.SendFailureNotification("verifyAndStoreSubmission", fmt.Sprintf("Error incrementing epochsubmissions: %v", err), time.Now().String(), "High")
Expand Down

0 comments on commit f6d1050

Please sign in to comment.