Skip to content

Instantly share code, notes, and snippets.

@brianmed
Last active April 16, 2016 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianmed/a594ef61e7308955ca84bc422bf001bf to your computer and use it in GitHub Desktop.
Save brianmed/a594ef61e7308955ca84bc422bf001bf to your computer and use it in GitHub Desktop.
First possibility for queue information in Minion
diff --git a/lib/Minion/Backend/Pg.pm b/lib/Minion/Backend/Pg.pm
index 63fd507..92e6d31 100644
--- a/lib/Minion/Backend/Pg.pm
+++ b/lib/Minion/Backend/Pg.pm
@@ -164,6 +164,17 @@ sub stats {
return $stats;
}
+sub queue_info {
+ shift->pg->db->query(
+ 'select id, args, attempts, extract(epoch from created) as created,
+ extract(epoch from delayed) as delayed,
+ extract(epoch from finished) as finished, priority, queue, result,
+ extract(epoch from retried) as retried, retries,
+ extract(epoch from started) as started, state, task, worker
+ from minion_jobs where queue = ?', shift
+ )->expand->hash;
+}
+
sub unregister_worker {
shift->pg->db->query('delete from minion_workers where id = ?', shift);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment