mirror of
https://github.com/acaloiaro/neoq
synced 2026-07-21 10:12:18 +00:00
code cleanup
This commit is contained in:
parent
e2b4608817
commit
1ce892ab15
1 changed files with 4 additions and 1 deletions
|
|
@ -46,7 +46,6 @@ const (
|
|||
AND status != "processed"
|
||||
AND run_after > datetime("now")
|
||||
ORDER BY run_after ASC`
|
||||
shutdownJobID = "-1" // job ID announced when triggering a shutdown
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -169,6 +168,7 @@ func (s *SqliteBackend) Enqueue(ctx context.Context, job *jobs.Job) (jobID strin
|
|||
// Rollback is safe to call even if the tx is already closed, so if
|
||||
// the tx commits successfully, this is a no-op
|
||||
defer func(ctx context.Context) { _ = tx.Rollback() }(ctx) // rollback has no effect if the transaction has been committed
|
||||
|
||||
jobID, err = s.enqueueJob(ctx, tx, job)
|
||||
if err != nil {
|
||||
s.logger.Error("error enqueueing job", slog.String("queue", job.Queue), slog.Any("error", err))
|
||||
|
|
@ -733,7 +733,10 @@ func (s *SqliteBackend) Shutdown(ctx context.Context) {
|
|||
}
|
||||
|
||||
s.cron.Stop()
|
||||
|
||||
s.dbMutex.Lock()
|
||||
s.db.Close()
|
||||
s.dbMutex.Unlock()
|
||||
|
||||
s.cancelFuncs = nil
|
||||
s.logger.Debug("shutdown complete")
|
||||
|
|
|
|||
Loading…
Reference in a new issue