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

Bug when setting CACHEOPS_DEFAULTS timeout value to 0. #93

Closed
jathanism opened this issue Mar 5, 2021 · 1 comment · Fixed by #94
Closed

Bug when setting CACHEOPS_DEFAULTS timeout value to 0. #93

jathanism opened this issue Mar 5, 2021 · 1 comment · Fixed by #94
Assignees
Labels
type: bug Something isn't working as expected
Milestone

Comments

@jathanism
Copy link
Contributor

Environment

  • Python version: 3.8.8
  • Nautobot version: 1.0.0b1

Steps to Reproduce

  1. Set CACHEOPS_DEFAULTS = {"timeout": 0} in your nautobot_config.py
  2. Start your server and load a page
  3. No profit. :(

Expected Behavior

Cache should be disabled.

Observed Behavior

500 error:

ResponseError: Error running script (call to f_f6b93ec749d56aefa37c49bbc5e7a6eedd0d4ec3): @user_script:15: ERR invalid expire time in setex
@jathanism jathanism added the type: bug Something isn't working as expected label Mar 5, 2021
@jathanism jathanism added this to the v1.0.0 milestone Mar 5, 2021
@jathanism
Copy link
Contributor Author

The correct solution to disabling the cache is actually setting CACHEOPS_ENABLED = False. This was overlooked during our fork and refactor process. The value inside of django-cacheops core defaults to True.

@jathanism jathanism self-assigned this Mar 5, 2021
jathanism added a commit that referenced this issue Mar 5, 2021
…94)

* Fix #83 - Implement a system check for `CACHEOPS_DEFAULT['timeout']`

This implements `nautobot.core.checks` and registers the first check error of `nautobot.E001` to assert that the value of `CACHEOPS_DEFAULTS['timeout']` can never be `0`.

When attempting to start the server if this value is `0`, startup is blocked and the following error will be displayed:

```
django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:

ERRORS:
?: (nautobot.E001) CACHEOPS_DEFAULTS['timeout'] value cannot be 0. To disable caching set CACHEOPS_ENABLED=False.

System check identified 1 issue (0 silenced).
```

- `CACHEOPS_ENABLED = True` added back explicitly to `nautobot.core.settings`
- `CACHEOPS_ENABLED = True` added to the template config at `nautobot.core.templates.nautobot_config.py.j2`
- `CACHEOPS_ENABLED` added to optional settings documentation
- A unit test for the check has been implemented

* Add `nautobot-server check` to deploy guide.

* Move "Check your Configuration" below "Test the Application"
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant