Skip to content

Commit

Permalink
WIP. Ugh. Neoq doesn't (yet) return completion notification.
Browse files Browse the repository at this point in the history
This is unfortunate, as without this capability Neoq will be
unusable for us:

  acaloiaro/neoq#93

Taking another look at the Neoq project and docs, this lack
doesn't seem to be clearly documented either.

Not sure if completion notification capability should be
expected in a job scheduling library though, as the only other
one I'm somewhat familiar with is RabbitMQ (which has it).

Neoq's job fingerprinting capability may cause problems for
us too later on, if that can't be disabled.  We defininitely
don't want to stop people running a particular task more than
once (aka "increment value foo", "create database abc", etc).
  • Loading branch information
justinclift committed Oct 8, 2023
1 parent efdda0b commit bd5b260
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
14 changes: 10 additions & 4 deletions common/live.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,22 +322,28 @@ func LiveSize(liveNode, loggedInUser, dbOwner, dbName string) (size int64, err e
payload["dbname"] = dbName
j := &jobs.Job{Queue: liveNode, Payload: payload}

done := make(chan bool)
//done := make(chan bool)
log.Printf("LiveSize() : Submitting job")
jobID, err := Nq.Enqueue(context.Background(), j)
if err != nil {
log.Printf("Unable to enqueue job: %s", err)
return
}

log.Printf("LiveSize() : Submitting job finished")
// Wait for the queued job to complete
<-done
//<-done





// Look for the job response in our database backend
log.Printf("LiveSize() : Looking for job response")
foo, err := MQGetResponse(jobID)
if err != nil {
return
}

log.Printf("LiveSize() : Looking for job response finished")
log.Printf("%s", foo)


Expand Down
2 changes: 2 additions & 0 deletions common/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -2863,6 +2863,8 @@ func LiveUserDBs(dbOwner string, public AccessType) (list []DBInfo, err error) {
return nil, err
}

log.Printf("WebUI LiveSize() returned")

list = append(list, oneRow)
}
return
Expand Down
4 changes: 2 additions & 2 deletions webui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4452,7 +4452,7 @@ func tableNamesHandler(w http.ResponseWriter, r *http.Request) {
return
}

// TODO: It would probably be useful to store these table names in memcache too, to later retrieval
// TODO: It would probably be useful to store these table names in memcache too, for later retrieval

// Return the table name info
w.WriteHeader(http.StatusOK)
Expand Down Expand Up @@ -4523,7 +4523,7 @@ func tableViewHandler(w http.ResponseWriter, r *http.Request) {
// Make sure the database exists in the system, and the user has access to it
var exists bool
exists, err = com.CheckDBPermissions(loggedInUser, dbOwner, dbName, false)
if err != err {
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
Expand Down

0 comments on commit bd5b260

Please sign in to comment.