Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

live: do the automatic check for new submissions every second #374

Merged
merged 1 commit into from
Jun 2, 2024
Merged
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
21 changes: 11 additions & 10 deletions live/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"log"
"os"
"time"

com "github.com/sqlitebrowser/dbhub.io/common"
"github.com/sqlitebrowser/dbhub.io/common/config"
Expand Down Expand Up @@ -66,18 +67,18 @@ func main() {
go com.JobQueueListen()

// Launch goroutine event generator for checking submitted jobs
// TODO: This seems to work fine, but is kind of a pita to have enabled while developing this code atm. So we disable it for now.
// NOTE: This seems to work fine, but is kind of a pita to have enabled while developing this code atm. So we disable it for now.
// TODO: Instead of this, should we run some code on startup of the live nodes that checks the database for
// (recent) unhandled requests, and automatically generates a JobQueueCheck() event if some are found?
//go func() {
// for {
// // Tell the JobQueueCheck() goroutine to check for newly submitted jobs
// com.CheckJobQueue <- struct{}{}
//
// // Wait a second before the next check
// time.Sleep(1 * time.Second)
// }
//}()
go func() {
for {
// Tell the JobQueueCheck() goroutine to check for newly submitted jobs
com.CheckJobQueue <- struct{}{}

// Wait a second before the next check
time.Sleep(1 * time.Second)
}
}()

log.Printf("%s: listening for requests", config.Conf.Live.Nodename)

Expand Down
Loading