mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-25 13:17:42 +00:00
set things right
This commit is contained in:
parent
0f70725be5
commit
09c42c379c
2 changed files with 6 additions and 4 deletions
|
@ -93,7 +93,7 @@ func main() {
|
|||
s.StartAsync()
|
||||
|
||||
signals := make(chan os.Signal, 1)
|
||||
signal.Notify(signals, syscall.SIGINT)
|
||||
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM)
|
||||
defer signal.Stop(signals)
|
||||
|
||||
<-signals // wait for signal
|
||||
|
@ -107,6 +107,8 @@ func main() {
|
|||
}
|
||||
|
||||
func enqueueAccounts(ctx context.Context, logger *logrus.Logger, pool *pgxpool.Pool, redisConn *redis.Client, queue rmq.Queue) {
|
||||
now := float64(time.Now().UnixNano()/int64(time.Millisecond)) / 1000
|
||||
|
||||
start := time.Now().Unix()
|
||||
end := start + 1
|
||||
|
||||
|
@ -126,10 +128,10 @@ func enqueueAccounts(ctx context.Context, logger *logrus.Logger, pool *pgxpool.P
|
|||
ORDER BY last_checked_at
|
||||
)
|
||||
UPDATE accounts
|
||||
SET last_enqueued_at = $1
|
||||
SET last_enqueued_at = $3
|
||||
WHERE accounts.id IN(SELECT id FROM account)
|
||||
RETURNING accounts.id`
|
||||
rows, err := tx.Query(ctx, stmt, start, end)
|
||||
rows, err := tx.Query(ctx, stmt, start, end, now)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ func main() {
|
|||
}
|
||||
|
||||
signals := make(chan os.Signal, 1)
|
||||
signal.Notify(signals, syscall.SIGINT)
|
||||
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM)
|
||||
defer signal.Stop(signals)
|
||||
|
||||
<-signals // wait for signal
|
||||
|
|
Loading…
Reference in a new issue