Python 3.12: cast random delays as int
This patch fixes 128 unit test failures under Python 3.12 when building the Debian package under Unstable. Without this patch, I'm getting: Traceback (most recent call last): File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner self.run() File "/usr/lib/python3.12/threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "/<<PKGBUILDDIR>>/mistral/services/legacy_scheduler.py", line 152, in _loop random.Random().randint(0, self._random_delay * 1000) * 0.001 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/random.py", line 336, in randint return self.randrange(a, b+1) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/random.py", line 312, in randrange istop = _index(stop) ^^^^^^^^^^^^ TypeError: 'float' object cannot be interpreted as an integer Change-Id: Ia85ea13923216d090ef1e4deee7840e70f9185b4
This commit is contained in:
parent
08b5a9b7c6
commit
2b2c8759d4
@ -149,7 +149,8 @@ class LegacyScheduler(sched_base.Scheduler):
|
||||
|
||||
eventlet.sleep(
|
||||
self._fixed_delay +
|
||||
random.Random().randint(0, self._random_delay * 1000) * 0.001
|
||||
random.Random().randint(0,
|
||||
int(self._random_delay * 1000)) * 0.001
|
||||
)
|
||||
|
||||
def _process_delayed_calls(self, ctx=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user