Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/prod-deploy-asynqmon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
script: |
cd /root/core/infra
git fetch
git checkout dev
git reset --hard origin/dev
git checkout master
git reset --hard origin/master
git pull

docker compose -f docker-compose.api.yml pull asynqmon
Expand Down
5 changes: 5 additions & 0 deletions apps/api/cmd/BAT_worker/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"time"

"github.com/hibiken/asynq"
Expand Down Expand Up @@ -57,6 +58,7 @@ func main() {
)

logger.Info().Msg("Debug test")
fmt.Print("Debug test")

schedulerLocation, err := time.LoadLocation("America/New_York")
if err != nil {
Expand All @@ -69,6 +71,9 @@ func main() {
},
)

logger.Info().Msg("Debug test")
fmt.Print("Debug test")

taskQueueClient := asynq.NewClient(redisOpt)

database := db.NewDB(cfg.DatabaseURL)
Expand Down
5 changes: 3 additions & 2 deletions apps/api/internal/workers/bat.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ func (w *BATWorker) HandleScheduleTransitionWaitlistTask(ctx context.Context, t
MaxAcceptedApplications: cfg.MaxAcceptedApplications,
})

w.scheduler.Start()
// The scheduler will make its first run after the period cycles once. So we queue our task immediately as well.
_, err = w.taskQueue.Enqueue(task, asynq.Queue("bat"))

w.scheduler.Start()
_, err = w.scheduler.Register(payload.Period, task, asynq.Queue("bat"))
if err != nil {
w.logger.Err(err)
return nil
}
_, err = w.taskQueue.Enqueue(task, asynq.Queue("bat"))

return nil
}
Expand Down