<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/redis-py.git/tests/test_lock.py, branch ROLE</title>
<subtitle>github.com: andymccurdy/redis-py.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/redis-py.git/'/>
<entry>
<title>Added black and isort (#1734)</title>
<updated>2021-11-30T16:05:51+00:00</updated>
<author>
<name>Anas</name>
<email>anas.el.amraoui@live.com</email>
</author>
<published>2021-11-30T16:05:51+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/redis-py.git/commit/?id=b94e230b17d08e6c89d134e933c706256b79bc4a'/>
<id>b94e230b17d08e6c89d134e933c706256b79bc4a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Adding RedisCluster client to support Redis Cluster Mode (#1660)</title>
<updated>2021-11-25T12:15:24+00:00</updated>
<author>
<name>Bar Shaul</name>
<email>88437685+barshaul@users.noreply.github.com</email>
</author>
<published>2021-11-25T12:15:24+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/redis-py.git/commit/?id=9db1eec71b443b8e7e74ff503bae651dc6edf411'/>
<id>9db1eec71b443b8e7e74ff503bae651dc6edf411</id>
<content type='text'>
Co-authored-by: Chayim &lt;chayim@users.noreply.github.com&gt;
Co-authored-by: Anas &lt;anas.el.amraoui@live.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Co-authored-by: Chayim &lt;chayim@users.noreply.github.com&gt;
Co-authored-by: Anas &lt;anas.el.amraoui@live.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>🕰️ Use monotonic clock in Lock (and tests)</title>
<updated>2020-10-12T16:07:10+00:00</updated>
<author>
<name>Jack Edge</name>
<email>yellowbounder@gmail.com</email>
</author>
<published>2020-09-24T14:34:19+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/redis-py.git/commit/?id=e635130043d7657d9bee6911995f649e2de9eb04'/>
<id>e635130043d7657d9bee6911995f649e2de9eb04</id>
<content type='text'>
During a call to `acquire()`, if the call is `blocking` and has a
`blocking_timeout` set, it uses `time.time()` calls to determine when to
give up attempting to acquire the lock.

However, since `time.time()` is marked as "adjustable", it is possible
for it to go backwards or forwards at a rate other than 1 second per
second, meaning the spinloop may exit earlier or later than expected.

By changing the implementation to use `time.monotonic()`, which is
guaranteed to never go backwards, and not be affected by system clock
updates, this potential problem is fixed.

For the same reason, some time dependent lock tests have also been
changed to use `time.monotonic()`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
During a call to `acquire()`, if the call is `blocking` and has a
`blocking_timeout` set, it uses `time.time()` calls to determine when to
give up attempting to acquire the lock.

However, since `time.time()` is marked as "adjustable", it is possible
for it to go backwards or forwards at a rate other than 1 second per
second, meaning the spinloop may exit earlier or later than expected.

By changing the implementation to use `time.monotonic()`, which is
guaranteed to never go backwards, and not be affected by system clock
updates, this potential problem is fixed.

For the same reason, some time dependent lock tests have also been
changed to use `time.monotonic()`.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove support for end-of-life Python 2.7 (#1318)</title>
<updated>2020-08-06T22:15:02+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2020-08-06T22:15:02+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/redis-py.git/commit/?id=8c5a41baf0bd2a1388d601e5b49d06b91997ccb8'/>
<id>8c5a41baf0bd2a1388d601e5b49d06b91997ccb8</id>
<content type='text'>
Remove support for end-of-life Python 2.7

Python 2.7 is end of life. It is no longer receiving bug fixes,
including for security issues. Python 2.7 went EOL on 2020-01-01. For
additional details on support Python versions, see:

Supported: https://devguide.python.org/#status-of-python-branches
EOL: https://devguide.python.org/devcycle/#end-of-life-branches

Removing support for EOL Pythons will reduce testing and maintenance
resources while allowing the library to move towards a modern Python 3
style. Python 2.7 users can continue to use the previous version of
redis-py.

Was able to simplify the code:

- Removed redis._compat module
- Removed __future__ imports
- Removed object from class definition (all classes are new style)
- Removed long (Python 3 unified numeric types)
- Removed deprecated __nonzero__ method
- Use simpler Python 3 super() syntax
- Use unified OSError exception
- Use yield from syntax

Co-authored-by: Andy McCurdy &lt;andy@andymccurdy.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove support for end-of-life Python 2.7

Python 2.7 is end of life. It is no longer receiving bug fixes,
including for security issues. Python 2.7 went EOL on 2020-01-01. For
additional details on support Python versions, see:

Supported: https://devguide.python.org/#status-of-python-branches
EOL: https://devguide.python.org/devcycle/#end-of-life-branches

Removing support for EOL Pythons will reduce testing and maintenance
resources while allowing the library to move towards a modern Python 3
style. Python 2.7 users can continue to use the previous version of
redis-py.

Was able to simplify the code:

- Removed redis._compat module
- Removed __future__ imports
- Removed object from class definition (all classes are new style)
- Removed long (Python 3 unified numeric types)
- Removed deprecated __nonzero__ method
- Use simpler Python 3 super() syntax
- Use unified OSError exception
- Use yield from syntax

Co-authored-by: Andy McCurdy &lt;andy@andymccurdy.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Add test for Lock(..., thread_local=False) (#1326)</title>
<updated>2020-04-11T20:20:16+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2020-04-11T20:20:16+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/redis-py.git/commit/?id=3261a05d670f14f5218b83c5d24b67d211efec94'/>
<id>3261a05d670f14f5218b83c5d24b67d211efec94</id>
<content type='text'>
Covers the class redis.utils.dummy.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Covers the class redis.utils.dummy.</pre>
</div>
</content>
</entry>
<entry>
<title>Lock.extend() can now replace the lock's existing TTL with a new value</title>
<updated>2020-03-24T21:56:15+00:00</updated>
<author>
<name>laixintao</name>
<email>laixintaoo@gmail.com</email>
</author>
<published>2020-03-10T03:18:33+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/redis-py.git/commit/?id=d1279291d68c77709d69fe13aa7ff6d912d98ce4'/>
<id>d1279291d68c77709d69fe13aa7ff6d912d98ce4</id>
<content type='text'>
Lock.extend() now has a new option, `replace_ttl`. When False (the
default), Lock.extend() adds the `additional_time` to the lock's existing
TTL. When replace_ttl=True, the lock's existing TTL is replaced with
the value of `additional_time`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Lock.extend() now has a new option, `replace_ttl`. When False (the
default), Lock.extend() adds the `additional_time` to the lock's existing
TTL. When replace_ttl=True, the lock's existing TTL is replaced with
the value of `additional_time`.
</pre>
</div>
</content>
</entry>
<entry>
<title>Optimize sleeping while blocking for a lock</title>
<updated>2020-02-24T19:38:29+00:00</updated>
<author>
<name>Colas Le Guernic</name>
<email>clslgrnc@users.noreply.github.com</email>
</author>
<published>2020-01-23T20:52:17+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/redis-py.git/commit/?id=03260002ded57223c5d05b2c99a0a710ee5d34f3'/>
<id>03260002ded57223c5d05b2c99a0a710ee5d34f3</id>
<content type='text'>
When waiting to acquire a lock, the Lock object will sleep until
the lock is acquired or until blocking_timeout has elapsed. This optimization
calculates whether the next iteration will occur after blocking_timeout
has elapsed and short circuits it immediately.

Fixes #1263
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When waiting to acquire a lock, the Lock object will sleep until
the lock is acquired or until blocking_timeout has elapsed. This optimization
calculates whether the next iteration will occur after blocking_timeout
has elapsed and short circuits it immediately.

Fixes #1263
</pre>
</div>
</content>
</entry>
<entry>
<title>Lock objects now support specifying token values and ownership checking</title>
<updated>2019-01-02T22:13:44+00:00</updated>
<author>
<name>Andy McCurdy</name>
<email>andy@andymccurdy.com</email>
</author>
<published>2019-01-02T22:13:44+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/redis-py.git/commit/?id=a3cfded93afa2a65908f05ac251b18d77fa84dd2'/>
<id>a3cfded93afa2a65908f05ac251b18d77fa84dd2</id>
<content type='text'>
Lock.acquire() can now be provided a token. If provided, this value will be
used as the value stored in Redis to hold the lock.

Lock.owned() returns a boolean indicating whether the lock is owned by the
current instance.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Lock.acquire() can now be provided a token. If provided, this value will be
used as the value stored in Redis to hold the lock.

Lock.owned() returns a boolean indicating whether the lock is owned by the
current instance.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add `.reacquire()` method to Lock</title>
<updated>2018-12-28T20:03:15+00:00</updated>
<author>
<name>Ihor Kalnytskyi</name>
<email>ihor@kalnytskyi.com</email>
</author>
<published>2018-07-24T16:14:50+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/redis-py.git/commit/?id=ff120df78ccd85d6e2e2938ee02d1eb831676724'/>
<id>ff120df78ccd85d6e2e2938ee02d1eb831676724</id>
<content type='text'>
`Lock` class provides a method called `.extend()` to manage a TTL of the
acquired lock. However, the method allows only to extend a timeout of
existing lock by N seconds, there's no way you can reset a TTL to the
timeout value you passed to this lock. There could be multiple use cases
for such behaviour. For instance, one may want to use a lock to
implement active/passive behaviour where only one process owns a lock
and resets its TTL all over again until it dies. This commit adds a new
method called `.reacquire()` to reset a TTL of the acquired lock back to
the passed timeout value.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`Lock` class provides a method called `.extend()` to manage a TTL of the
acquired lock. However, the method allows only to extend a timeout of
existing lock by N seconds, there's no way you can reset a TTL to the
timeout value you passed to this lock. There could be multiple use cases
for such behaviour. For instance, one may want to use a lock to
implement active/passive behaviour where only one process owns a lock
and resets its TTL all over again until it dies. This commit adds a new
method called `.reacquire()` to reset a TTL of the acquired lock back to
the passed timeout value.
</pre>
</div>
</content>
</entry>
<entry>
<title>rename new LockErrorNotOwned to LockNotOwnedError</title>
<updated>2018-12-03T22:08:01+00:00</updated>
<author>
<name>Andy McCurdy</name>
<email>andy@andymccurdy.com</email>
</author>
<published>2018-12-03T22:08:01+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/redis-py.git/commit/?id=d7bd3e6e6aa9ba42e796f053208dde5b3ea81b3b'/>
<id>d7bd3e6e6aa9ba42e796f053208dde5b3ea81b3b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
