Skip to content

Commit

Permalink
Merge pull request #6 from bensonrodney/master
Browse files Browse the repository at this point in the history
Handle longer tube names in the output of q-stat.
  • Loading branch information
chexov authored Feb 16, 2023
2 parents 3cf7ac3 + 77e22f6 commit 5b65848
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions beanstalkd/queueit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,13 @@ def compare_numbers(last, cur):
qconn = _get_qconnection(QHOST, QPORT)
tubes_stats_last = {}
while True:
LINE = "%-24s %-10s %-10s %-10s %-10s %-10s"
print(LINE % ('tube', 'watching', 'buried', 'ready', 'delayed', 'reserved'))
tubes = qconn.tubes()
tube_name_length = 24
for tube in tubes:
if tube:
tube_name_length = max(len(str(tube)) + 3, tube_name_length)
LINE = "%-{}s %-10s %-10s %-10s %-10s %-10s".format(tube_name_length)
print(LINE % ('tube', 'watching', 'buried', 'ready', 'delayed', 'reserved'))
for tube in tubes:
if tube:
name = str(tube)
Expand Down

0 comments on commit 5b65848

Please sign in to comment.