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

Commit 35f2b00

Browse files
committed
live: do the automatic check for new submissions every second
This should solve a potential hang condition from when the live server is being worked upon and jobs are being queued
1 parent 2c2e140 commit 35f2b00

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

live/main.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"errors"
77
"log"
88
"os"
9+
"time"
910

1011
com "github.com/sqlitebrowser/dbhub.io/common"
1112
"github.com/sqlitebrowser/dbhub.io/common/config"
@@ -66,18 +67,18 @@ func main() {
6667
go com.JobQueueListen()
6768

6869
// Launch goroutine event generator for checking submitted jobs
69-
// 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.
70+
// 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.
7071
// TODO: Instead of this, should we run some code on startup of the live nodes that checks the database for
7172
// (recent) unhandled requests, and automatically generates a JobQueueCheck() event if some are found?
72-
//go func() {
73-
// for {
74-
// // Tell the JobQueueCheck() goroutine to check for newly submitted jobs
75-
// com.CheckJobQueue <- struct{}{}
76-
//
77-
// // Wait a second before the next check
78-
// time.Sleep(1 * time.Second)
79-
// }
80-
//}()
73+
go func() {
74+
for {
75+
// Tell the JobQueueCheck() goroutine to check for newly submitted jobs
76+
com.CheckJobQueue <- struct{}{}
77+
78+
// Wait a second before the next check
79+
time.Sleep(1 * time.Second)
80+
}
81+
}()
8182

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

0 commit comments

Comments
 (0)