Skip to content

Commit 0b9d9f8

Browse files
aarnaudloewenheim
andauthored
fix(redis-lua): compatibility with dragonfly and lua 5.4 (#65825)
Because there is no way to have a full high availability Redis (cluster, sentinel) compatible with Sentry yet. As an alternative Dragonfly DB can be used. This PR fix the `math.randomseed` that take integers but Sentry send `float`. In lua 5.1 it doesn't seem to be an issue but with lua 5.4 in Dragonfly DB. An other small difference is `redis.log` that don't exist but it's used one time, so I replace it by a `print`. ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. Signed-off-by: Anthony ARNAUD <github@anthony-arnaud.fr> Co-authored-by: Sebastian Zivota <loewenheim@users.noreply.github.com>
1 parent ea4100d commit 0b9d9f8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/sentry/scripts/digests/digests.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ local configuration_argument_parser = object_argument_parser({
354354
{"ttl", argument_parser(tonumber)},
355355
{"timestamp", argument_parser(tonumber)},
356356
}, function (configuration)
357-
math.randomseed(configuration.timestamp)
357+
math.randomseed(math.floor(configuration.timestamp))
358358

359359
function configuration:get_schedule_waiting_key()
360360
return string.format('%s:s:w', self.namespace)

src/sentry/scripts/similarity/index.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ This is modeled as two data structures:
2727
-- greater. This is wrapped in `pcall` so that we can continue to support older
2828
-- Redis versions while using this feature if it's available.
2929
if not pcall(redis.replicate_commands) then
30-
redis.log(redis.LOG_DEBUG, 'Could not enable script effects replication.')
30+
if redis.log == nil then
31+
print('Could not enable script effects replication.')
32+
else
33+
redis.log(redis.LOG_DEBUG, 'Could not enable script effects replication.')
34+
end
3135
end
3236

3337

0 commit comments

Comments
 (0)