From bee6fcfc8dd62501e025c48fe5bd65258f0fb34f Mon Sep 17 00:00:00 2001 From: bel Date: Thu, 27 Jan 2022 16:05:17 -0700 Subject: [PATCH 1/3] log because i think i deploy bad --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index 3f49dc5..58f56f7 100644 --- a/main.go +++ b/main.go @@ -316,11 +316,14 @@ func getJobs() ([]broker.Job, error) { states := config.AllStates() brokers := []broker.Broker{} if config.Get().Brokers.NTG.Enabled { + logtr.Debugf("NTG enabled") brokers = append(brokers, broker.NewNTGVision()) } if config.Get().Brokers.FastExact.Enabled { + logtr.Debugf("FastExact enabled") brokers = append(brokers, broker.NewFastExact()) } + logtr.Debugf("brokers=%+v", brokers) jobs := []broker.Job{} for _, broker := range brokers { somejobs, err := broker.Search(states) From ae4c5bd8866f913da448184c3d5d9ad9d9ea1775 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Thu, 27 Jan 2022 16:22:58 -0700 Subject: [PATCH 2/3] backward compatible from ID to uid for sent_jobs --- main.go | 4 ++-- todo.yaml | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 3a99299..e7717c5 100644 --- a/main.go +++ b/main.go @@ -345,7 +345,7 @@ func updateDeadJobs(jobs []broker.Job) error { wouldBe := strings.TrimPrefix(listEntry, "sent_job_") found := false for i := range jobs { - found = found || jobs[i].ID == wouldBe + found = found || jobs[i].UID() == wouldBe || jobs[i].ID == wouldBe } logtr.Debugf("found job %s to be still alive==%v", wouldBe, found) if !found { @@ -420,7 +420,7 @@ func sendJob(job broker.Job) (bool, error) { logtr.Errorf("failed to marshal recorded job: %v", err) return } - if err := db.Set("sent_job_"+job.ID, b); err != nil { + if err := db.Set("sent_job_"+job.UID(), b); err != nil { logtr.Errorf("failed to set recorded job: %v", err) return } diff --git a/todo.yaml b/todo.yaml index decc1ce..1520419 100644 --- a/todo.yaml +++ b/todo.yaml @@ -1,20 +1,21 @@ todo: -- !states emits current state -- TEST. Just like, refactor and test to shit. -- try search ntg by autoinc? +- fast exact is dumb or...? +- modify old items once no longer available; drop stale jobs good candidate but requires new matrix interaction +- more than NTG; blue one +- !states emits current state - test each !command callbacks to matrix - recv-as for clients so pa receives mas commands as writes - continuation is garbo, but I can still do better client side to avoid get-set high level - no hard code jpeg or have it in multiple places - change matrix so I test my custom logic even if I dont fetch remote - warn/err/etc. on clobbering ids.matrix since clients can mess with one another -- modify old items once no longer available; drop stale jobs good candidate but requires new matrix interaction -- more than NTG - todo: filter out jobs like CA subtasks: - banlist criteria like vendors, brokers, metadata - set up copy for caleb, broc done: +- try search ntg by autoinc? +- TEST. Just like, refactor and test to shit. - mark jobs no longer avail by modifying in matrix;; save matrix ID over dummy payload - TEST its falling apart - help() log on truckstop for stuff like perma 403 From d456de12e89a40572f606a056f8c30688b938fce Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Thu, 27 Jan 2022 16:34:53 -0700 Subject: [PATCH 3/3] logs but no changes --- config.json | 10 +++++----- main.go | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config.json b/config.json index a1149ac..1f2243f 100644 --- a/config.json +++ b/config.json @@ -34,7 +34,7 @@ "Pickup": false, "Dropoff": false, "Pathed": { - "Enabled": true, + "Enabled": false, "DirectionsURIFormat": "https://maps.googleapis.com/maps/api/directions/json?origin=%s\u0026destination=%s\u0026mode=driving\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg", "PathedURIFormat": "https://maps.googleapis.com/maps/api/staticmap?size=250x250\u0026path=%s\u0026format=jpeg\u0026maptype=roadmap\u0026key=AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg\u0026size=250x250\u0026markers=%s|%s", "Zoom": { @@ -69,17 +69,17 @@ "Room": "!OYZqtInrBCn1cyz90D:m.bltrucks.top" } }, - "Once": true, + "Once": false, "Brokers": { "FastExact": { "RadiusMiles": 100, "Enabled": true, "Mock": true, - "Username": "u", - "Password": "p" + "Username": "birdman", + "Password": "166647" }, "NTG": { - "Enabled": true, + "Enabled": false, "JobInfo": true, "Mock": true, "LoadPageURIFormat": "https://ntgvision.com/LoadDetails?loadId=%d", diff --git a/main.go b/main.go index 9348877..2a01a34 100644 --- a/main.go +++ b/main.go @@ -303,7 +303,7 @@ func once() error { if ok, err := sendJob(jobs[i]); err != nil { return err } else if ok { - logtr.Debugf("sent job", jobs[i]) + logtr.Debugf("sent job %+v", jobs[i]) if err := db.Set(jobs[i].UID(), []byte(`sent`)); err != nil { return err } @@ -371,14 +371,14 @@ func updateDeadJobs(jobs []broker.Job) error { } */ if err := message.NewMatrix().Remove(recorded.MatrixID); err != nil { - return err + logtr.Debugf("failed to remove matrix: %v: %v", recorded.MatrixID, err) } if err := db.Set(listEntry, nil); err != nil { - return err + logtr.Debugf("failed to remove db: %v: %v", listEntry, err) } for _, imageid := range recorded.MatrixImageIDs { if err := message.NewMatrix().Remove(imageid); err != nil { - return err + logtr.Debugf("failed to remove matrix image: %v: %v", imageid, err) } } } @@ -407,7 +407,7 @@ func dropBanlistJobs(jobs []broker.Job) ([]broker.Job, error) { func sendJob(job broker.Job) (bool, error) { sender := message.NewMatrix() payload := job.FormatMultilineText() - logtr.Debugf("once: send job %s if nonzero: %s", job.String(), payload) + logtr.Debugf("once: send job %s if nonzero: %q", job.String(), payload) if len(payload) == 0 { return false, nil }