summaryrefslogtreecommitdiff
path: root/app/helpers/sidekiq_helper.rb
diff options
context:
space:
mode:
authorPascal Betz <pascal.betz@gmail.com>2016-09-06 21:40:49 +0200
committerPascal Betz <pascal.betz@gmail.com>2016-09-07 12:16:05 +0200
commit1112b5a28323bdcee5b7e910575097d1ccb6256c (patch)
treeacd6378f677a3ee7e63ce58662cbfbbebc68e0c0 /app/helpers/sidekiq_helper.rb
parent80e575af523f49d314dc83e02989115193b9ab64 (diff)
downloadgitlab-ce-1112b5a28323bdcee5b7e910575097d1ccb6256c.tar.gz
Move parsing of sidekiq ps into helper
Diffstat (limited to 'app/helpers/sidekiq_helper.rb')
-rw-r--r--app/helpers/sidekiq_helper.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/helpers/sidekiq_helper.rb b/app/helpers/sidekiq_helper.rb
new file mode 100644
index 00000000000..3644039d38e
--- /dev/null
+++ b/app/helpers/sidekiq_helper.rb
@@ -0,0 +1,12 @@
+module SidekiqHelper
+ SIDEKIQ_PS_REGEXP = /\A([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+(.+)\s+(sidekiq.*\])\s+\z/
+
+ def parse_sidekiq_ps(line)
+ match = line.match(SIDEKIQ_PS_REGEXP)
+ if match
+ match[1..6]
+ else
+ %w{? ? ? ? ? ?}
+ end
+ end
+end