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

Successful tasks are not being saved to the database when 'save_limit' config setting is 0 #157

Closed
kefin opened this issue Apr 4, 2016 · 1 comment

Comments

@kefin
Copy link

kefin commented Apr 4, 2016

The django-q docs says:

save_limit
Limits the amount of successful tasks saved to Django.

- Set to 0 for unlimited.
- Set to -1 for no success storage at all.
- Defaults to 250
- Failures are always saved.

I have save_limit set to 0 in my config:

    Q_CLUSTER = {
    ...
    'save_limit': 0,
    ....
}

but none of the successful tasks are being saved to the db.

Setting save_limit to a positive value works, though.

I'm thinking line 402 from the save_task function in cluster.py may be the culprit:

# SAVE LIMIT < 0 : Don't save success
if not task.get('save', Conf.SAVE_LIMIT > 0) and task['success']:
    return

and Conf.SAVE_LIMIT > 0 should be Conf.SAVE_LIMIT >= 0:

# SAVE LIMIT < 0 : Don't save success
if not task.get('save', Conf.SAVE_LIMIT >= 0) and task['success']:
    return

Or am I overlooking something in my config?

@Koed00
Copy link
Owner

Koed00 commented Apr 6, 2016

Yep, another good spot. Thanks for taking the time to point this out.
I'll fix this soon.

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

No branches or pull requests

2 participants