Qpid
  1. Qpid
  2. QPID-3738

Non-intuitive qpid-stat -L / --limit option application

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Trivial Trivial
    • Resolution: Unresolved
    • Affects Version/s: 0.12
    • Fix Version/s: None
    • Component/s: Python Tools
    • Labels:
      None

      Description

      There are a couple of minor things about the way qmf-stat's -L option is applied that I think are worth revising.

      Firstly, the option defaults to 50. IMO, a default of 0 (or no limit) would be more appropriate. I can think only two reasons the limit may have been set to something non-zero.

      1. To return early when receiving a long list of items from the Qpid library? The code does not do this. Even with a limit of 50, all possible items are fetched first.
      2. To avoid having to sort the entire list? As it is now, the sort function sorts all items returned, and only then considers this limit.

      So I'm guessing the limit is only there to help the user manage their screen output (a valid purpose), but I think the usual convention with *nix utils is to return everything, unless asked to do otherwise (ie default to no-limit).

      Secondly, the -L option seems to only apply to sorted results. For example:

      qpid-stat -q -L 10         // Shows as many queues as possible (the -L is silently ignored).
      qpid-stat -qIS queue -L 10 // Shows up to 10 queues (assuming QPID-3737 has been applied).
      

      Furthermore, this second issue compounds the first. For example:

      qpid-stat -q         // Shows as many queues as possible.
      qpid-stat -qIS queue // Shows up to 50 queues.
      

      I'm not sure what the best solution to this second issue should be... perhaps either:

      1. add code to apply the limit when not sorting too; or
      2. drop the -L flag altogether.

      Personally, I'm in favour of simply dropping that option since its more natural for me to use tools like head and less, but if the default limit was set to zero (ie no-limit), then it wouldn't matter to me either way

      Ideas? thoughts? preferences?

        Activity

        Paul Colby created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Paul Colby
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development