mosquito-cr / mosquito

A background task runner for crystal applications supporting periodic (CRON) and manually queued jobs
MIT License
227 stars 24 forks source link

feat(queue): allow to exclude dead queue from `size` #143

Closed lsndr closed 4 months ago

lsndr commented 4 months ago

Thank you for the library!

This commit adds ability to pass include_dead from Queue.size to Backend.size.

It can be quite crucial to exclude dead queue size from job's queue size, since dead letter queue is never cleaned. As for now it's possible to call SomeJob.queue.backend.size(false), but from client's perspective it looks like accessing some internals. In my opinion SomeJob.queue.size(false) would be better in terms of encapsulation.

IMHO Queue.backend can be marked as private

robacarp commented 4 months ago

@lsndr thanks for your suggestion!

robacarp commented 4 months ago

thanks @lsndr!