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

No longer override Django's native timeout parameter handling #36

Closed
wants to merge 2 commits into from
Closed

No longer override Django's native timeout parameter handling #36

wants to merge 2 commits into from

Conversation

edmorley
Copy link
Contributor

Django has since fixed the issue that prevented setting an infinite timeout, which can now be done using a timeout value of None. However their chosen solution is not consistent with the approach taken by django-pylibmc's custom get_backend_timeout().

Even though this is a non-backwards compatible change for people using a timeout value of 0 with django-pylibmc, the custom handling should still be removed, to:

  • simplify the django-pylibmc codebase
  • make django-pylibmc's behaviour consistent with the Django docs
  • avoid changes in behaviour when people switch from the native backend
    to django-pylibmc, expecting it to be a drop-in replacement.

This change will need a major version bump of django-pylibmc.

Fixes #35.

@edmorley
Copy link
Contributor Author

The test failures are due to inconsistent negative timeout handling in pylibmc/libmemcached when using binary mode, for which I've filed lericson/pylibmc#202.

These failures don't occur when running the Django test suite (from which the pylibmc tests are derived) since Django doesn't yet support binary mode (https://code.djangoproject.com/ticket/15815).

I'd like to upstream much of this backend into Django, so I guess we'll need to figure out the best way to handle this at some point :-(

Ed Morley added 2 commits January 28, 2016 16:05
https://docs.travis-ci.com/user/trusty-ci-environment

In this new stack, Python 3.5 is not installed by default, so we set the
global Python version to 3.5 to force this install. Tox will still use
the appropriate version of Python for each test run within the job.
Django has since fixed the issue that prevented setting an infinite
timeout, which can now be done using a timeout value of `None`. However
their chosen solution is not consistent with the approach taken by
django-pylibmc's custom `get_backend_timeout()`.

Even though this is a non-backwards compatible change for people using a
timeout value of `0` with django-pylibmc, the custom handling should
still be removed, to:
* simplify the django-pylibmc codebase
* make django-pylibmc's behaviour consistent with the Django docs
* avoid changes in behaviour when people switch from the native backend
  to django-pylibmc, expecting it to be a drop-in replacement.

The adjusted test was copied from:
https://github.com/django/django/blob/a6d463b0965bcdabc202450f00d2c09f944f8edb/tests/cache/tests.py#L522-L534

This change will need a major version bump of django-pylibmc.

Fixes #35.
@jwhitlock
Copy link
Member

Did #42 handle this change, or are there additional fixes in this PR?

@edmorley
Copy link
Contributor Author

Sorry for the delayed reply! #42 was just a subset of the removal, so this PR is still applicable.

This PR was blocked on figuring out what to do with the test failures from negative timeouts. It turns out that with the binary protocol, negative timeouts are actually invalid, which I've had them clarify in the specification:
memcached/memcached#142 (comment)

Ideally libmemcached or pylibmc would raise a ValueError when using a negative timeout with the binary protocol, but they don't at present (see lericson/pylibmc#202 (comment) onwards).

In the meantime I think django-pylibmc should just skip the negative timeout tests when using the binary protocol, and document that it's not a valid value.

@jwhitlock
Copy link
Member

@edmorley are you interested in doing the rebase work to resolve the conflicts with the main branch?

@edmorley
Copy link
Contributor Author

I was going to double back to this after the extra tests PR was merged :-)

@jwhitlock
Copy link
Member

Hmm I missed PR #49. It's now merged, rebase away.

@edmorley
Copy link
Contributor Author

edmorley commented Oct 3, 2018

I unfortunately won't have time to work on this any more, since we now use Redis/django-redis.

@edmorley edmorley closed this Oct 3, 2018
@edmorley edmorley deleted the rm-timeout-overriding branch October 3, 2018 19:16
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

Successfully merging this pull request may close these issues.

Remove workaround for setting an infinite timeout
2 participants