Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete job functionality #48

Open
francislavoie opened this issue Mar 15, 2017 · 4 comments
Open

Delete job functionality #48

francislavoie opened this issue Mar 15, 2017 · 4 comments
Milestone

Comments

@francislavoie
Copy link
Contributor

francislavoie commented Mar 15, 2017

So, we have a default expiry for jobs, but I have a use-case where I want to get rid of data as quick as possible for security reasons. I want to handle sensitive data with jobs but once it's processed I want to get rid of the payload as quickly as possible.

We have this issue #34 which kinda ties into this a bit.

I propose two options:

  • add a delete() function to Job.php which would have the job delete itself from redis, something like $this->redis->del(self::redisKey($this));
  • add a setExpiry(int seconds) function to Job.php which can manually set the expiry time. This could indirectly be used to delete things by setting the seconds to 0 I think. e.g. $this->redis->expire(self::redisKey($this), seconds); (we'd need to validate the inputs here), in addition this function could replace this usage of $this->redis->expire in Job.php

I think both are good options, we could implement them both. They cover different use-cases.

Thoughts?

@xelan
Copy link
Collaborator

xelan commented Mar 16, 2017

Great suggestions, thank you! You're right, probably both would be useful in different contexts/use cases. I agree that proper input validation and error handling are very important when implementing this feature.

@xelan xelan added this to the 2.1 milestone Mar 16, 2017
@mplx
Copy link
Contributor

mplx commented Mar 17, 2017

Thinking of use-cases maybe the expiry time could be split into several scenarios?

  • expiry time for succeeded jobs [if a jobs succeeds it will be removed from redis within a individual timeframe; currently 1w?]
  • expiry time for failed jobs [if a jobs fails it will be removed from redis within a individual timeframe; currently: never?]
  • expiry time until execution [if a job is not performed (started) by a worker within an individual timeframe its removed from the queue; currently not implemented]

@francislavoie
Copy link
Contributor Author

francislavoie commented Mar 17, 2017

Yeah, that makes sense. Good ideas 👍

I might want to only expire a certain class of jobs though, so manual control as I suggested would still be very good.

@xelan xelan modified the milestones: 2.2, 2.1 Aug 31, 2017
@PAXANDDOS
Copy link
Contributor

PAXANDDOS commented Feb 20, 2023

Wait... was this implemented? Kinda looking for such a function but it appears I'll have to delete the job somehow else

Seems the only way to delete the job is by creating Predis\Client instance and using del():

(\Resque\Redis::instance())->del("resque:job:jobId")

but job still somehow "remains in memory" after scanning for them with lrange() or zrevrangebyscore() or within the stats. Have to load this job using Job::load() which will return null for such deleted jobs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants