binarymatt / pyres

a resque clone in python
http://github.com/binarydud/pyres
MIT License
955 stars 130 forks source link

delete_all_failed view doesn't update the stats #49

Closed robbiehudson closed 13 years ago

robbiehudson commented 14 years ago

The delete all view directly removes the failed queue from Redis. This means that the stats don't get updated.

binarymatt commented 14 years ago

good catch. I'll try to take a look this weekend

robbiehudson commented 13 years ago

Did you have any luck with this?

binarymatt commented 13 years ago

I've taken a little deeper look and I'm not sure what I want to do. The stats are there to say that n number of jobs have failed, they aren't really there to give a count of the number of jobs in the failed queue.

What is the use case you have for changing the stats count?

robbiehudson commented 13 years ago

Good point.

We're using it to monitor how many jobs have failed (so we can set an alert if it gets too high).

At the moment the length of the failed queue isn't exposed through the res object. We can just do something like redis.llen("resque:failed") but it'd be nice if we could access that through the res object (res.failed_size()) for instance.

binarymatt commented 13 years ago

you could use the count function in the failure module.

from pyres import failure
failure.count(resq)
binarymatt commented 13 years ago

i'm going to close this out since there is a solution