From bd5b260922001de11b0ac1f63597e88d199db6a5 Mon Sep 17 00:00:00 2001 From: Justin Clift Date: Mon, 9 Oct 2023 02:51:00 +1000 Subject: [PATCH] WIP. Ugh. Neoq doesn't (yet) return completion notification. This is unfortunate, as without this capability Neoq will be unusable for us: https://github.com/acaloiaro/neoq/issues/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). --- common/live.go | 14 ++++++++++---- common/postgresql.go | 2 ++ webui/main.go | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/common/live.go b/common/live.go index c3ef18566..0b6c90811 100644 --- a/common/live.go +++ b/common/live.go @@ -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) diff --git a/common/postgresql.go b/common/postgresql.go index 0ca092608..bbb3383ac 100644 --- a/common/postgresql.go +++ b/common/postgresql.go @@ -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 diff --git a/webui/main.go b/webui/main.go index a292b5156..582280a0c 100644 --- a/webui/main.go +++ b/webui/main.go @@ -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) @@ -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 }