jamesrwhite / minicron

🕰️ Monitor your cron jobs
GNU General Public License v3.0
2.34k stars 154 forks source link

Avoid many delete and high cpu #217

Closed dukex closed 8 years ago

dukex commented 8 years ago
.... 500 delete before ....
D, [2016-03-30T06:16:25.905753 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112830]]
D, [2016-03-30T06:16:25.944773 #14122] DEBUG -- :   SQL (0.4ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112831]]
D, [2016-03-30T06:16:25.945878 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112832]]
D, [2016-03-30T06:16:25.946767 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112833]]
D, [2016-03-30T06:16:25.948042 #14122] DEBUG -- :   SQL (0.3ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112834]]
D, [2016-03-30T06:16:25.949175 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112835]]
D, [2016-03-30T06:16:25.950311 #14122] DEBUG -- :   SQL (0.3ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112836]]
D, [2016-03-30T06:16:25.951284 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112837]]
D, [2016-03-30T06:16:25.952060 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112838]]
D, [2016-03-30T06:16:25.952939 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112839]]
D, [2016-03-30T06:16:25.953866 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112840]]
D, [2016-03-30T06:16:25.954664 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112841]]
D, [2016-03-30T06:16:25.955800 #14122] DEBUG -- :   SQL (0.3ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112842]]
D, [2016-03-30T06:16:25.956687 #14122] DEBUG -- :   SQL (0.2ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112843]]
D, [2016-03-30T06:16:25.957585 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112844]]
D, [2016-03-30T06:16:25.958649 #14122] DEBUG -- :   SQL (0.2ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112845]]
D, [2016-03-30T06:16:25.959411 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112846]]
D, [2016-03-30T06:16:25.960405 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112847]]
D, [2016-03-30T06:16:25.961253 #14122] DEBUG -- :   SQL (0.1ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112848]]
D, [2016-03-30T06:16:25.962222 #14122] DEBUG -- :   SQL (0.2ms)  DELETE FROM "job_execution_outputs" WHERE "job_execution_outputs"."id" = ?  [["id", 112849]]
.... 500 delete after ....

Today when I try to delete a old job or an execution the minicron top my CPU

jamesrwhite commented 8 years ago

Thanks for this but it needs to go into the develop branch as explained in CONTRIBUTING.md. Would it make sense to make this same change to all models also?

If you can re-open a PR on the right branch I will happily review and merge it :)

dukex commented 8 years ago

Oh Sorry!