This is trickier than it seems. The implementation in
https://gist.github.com/tdg5/7891302 is linear in the
total number of jobs. We avoid exposing commands
that have more than logarithmic run time (amortized).

On Tue, Dec 10, 2013 at 6:24 AM, tdg5 <[email protected]> wrote:
> Hello!
>
> I've put together some code to add a "peek-oldest" command to peek the
> oldest job and I was wondering if the community here thinks such a command
> is worthy of a pull request?
>
> I was experimenting with writing the command as part of work to write a test
> library for the Ruby Beanstalkd client, Beaneater. In said library, I'd like
> to be able to have an assertion like assert_enqueued, but such an assertion
> would require a full scan of every job id up to the most recent id, which
> can become prohibitive as a server's job ids get higher. Though in some
> situations it wouldn't be much help, a "peek-oldest" command would at least
> provide a lower bound on the scan in most situations.
>
> For my particular purposes a "list-jobs" command that returned a list of job
> ids would be more useful, though I'm not sure if that jives with the
> community ideology and I prefer to write code for community-use rather than
> spin off an obscure fork. If a "list-jobs" command sounds useful, I'd be
> happy to look into writing one.
>
> Anyway, beyond my purposes, it seems to me that a "peek-oldest" command
> would be useful in other circumstances as well.
>
> I threw up a gist of the diff here: https://gist.github.com/tdg5/7891302,
> but it lacks crucial things like documentation.
>
> Leave me some feedback and I'll look into a PR if it seems appropriate.
>
> Thanks!
>
> Danny
>
> --
> You received this message because you are subscribed to the Google Groups
> "beanstalk-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/beanstalk-talk.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"beanstalk-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/beanstalk-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to