Skip to content

Commit

Permalink
Merge pull request #9 from opensciencegrid/check-queue-startup
Browse files Browse the repository at this point in the history
Check for on-disk messages on startup
  • Loading branch information
djw8605 authored Apr 21, 2022
2 parents b44320d + d4bed30 commit 97cd33d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package main
import (
"container/list"
"errors"
"github.com/joncrlsn/dque"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"path"
"sync"
"time"

"github.com/joncrlsn/dque"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
)

type MessageStruct struct {
Expand Down Expand Up @@ -57,6 +58,11 @@ func (cq *ConfirmationQueue) Init() *ConfirmationQueue {
log.Errorln("Failed to turn on dque Turbo mode, the queue will be safer but much slower:", err)
}

// Check if we have any messages in the queue
if cq.diskQueue.Size() > 0 {
cq.usingDisk = true
}

cq.emptyCond = sync.NewCond(&cq.mutex)

// Start the metrics goroutine
Expand Down

0 comments on commit 97cd33d

Please sign in to comment.