Skip to content

Commit

Permalink
give ourselves up to 3 hours per archive deletion, 15 mins per transa…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
nicpottier committed Jan 8, 2019
1 parent 9626017 commit 4597a36
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ var deleteTransactionSize = 100
//
// Upon completion it updates the needs_deletion flag on the archive
func DeleteArchivedMessages(ctx context.Context, config *Config, db *sqlx.DB, s3Client s3iface.S3API, archive *Archive) error {
outer, cancel := context.WithTimeout(ctx, time.Minute*15)
outer, cancel := context.WithTimeout(ctx, time.Hour*3)
defer cancel()

start := time.Now()
Expand Down Expand Up @@ -1254,7 +1254,7 @@ func DeleteArchivedMessages(ctx context.Context, config *Config, db *sqlx.DB, s3
// ok, delete our messages in batches, we do this in transactions as it spans a few different queries
for startIdx := 0; startIdx < len(msgIDs); startIdx += deleteTransactionSize {
// no single batch should take more than a few minutes
ctx, cancel := context.WithTimeout(ctx, time.Minute*5)
ctx, cancel := context.WithTimeout(ctx, time.Minute*15)
defer cancel()

start := time.Now()
Expand Down Expand Up @@ -1386,7 +1386,7 @@ WHERE id IN(?)
//
// Upon completion it updates the needs_deletion flag on the archive
func DeleteArchivedRuns(ctx context.Context, config *Config, db *sqlx.DB, s3Client s3iface.S3API, archive *Archive) error {
outer, cancel := context.WithTimeout(ctx, time.Hour)
outer, cancel := context.WithTimeout(ctx, time.Hour*3)
defer cancel()

start := time.Now()
Expand Down Expand Up @@ -1455,7 +1455,7 @@ func DeleteArchivedRuns(ctx context.Context, config *Config, db *sqlx.DB, s3Clie
// ok, delete our runs in batches, we do this in transactions as it spans a few different queries
for startIdx := 0; startIdx < len(runIDs); startIdx += deleteTransactionSize {
// no single batch should take more than a few minutes
ctx, cancel := context.WithTimeout(ctx, time.Minute*5)
ctx, cancel := context.WithTimeout(ctx, time.Minute*15)
defer cancel()

start := time.Now()
Expand Down

0 comments on commit 4597a36

Please sign in to comment.