zonemaster / zonemaster-backend

The Zonemaster Backend - part of the Zonemaster project
Other
14 stars 23 forks source link

Check that a job is "running" before inserting results #1135

Open ghost opened 12 months ago

ghost commented 12 months ago

This was suggested in #1092, see https://github.com/zonemaster/zonemaster-backend/pull/1092#discussion_r1397521396

It would be super-nice if we could verify that the job is "running" when performing the insert and throw an error otherwise.

The associated code lies in DB.pm:

my $query = "INSERT INTO result_entries (hash_id, level, module, testcase, tag, timestamp, args) VALUES $query_values";

https://github.com/pnax/zonemaster-backend/blob/33e32e4927fd9263097b10c222252928befbd9cc/lib/Zonemaster/Backend/DB.pm#L1024

And a following comment provided a proof a concept using a query like INSERT INTO result_entries UNION SELECT id, ? FROM test_results WHERE id = ? AND progress > 0 AND progress < 100 UNION .... See https://github.com/zonemaster/zonemaster-backend/pull/1092#discussion_r1400605859