mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-18 03:23:37 +08:00
Use rand() instead of random()
Use rand() instead of random() cause the latter is not available on Windows and postgres stopped backporting it with PG15. Ideally we switch to the crypto functions added in PG15 but that requires a bit more work and this is the minimal change required to get it to build against PG15 on Windows.
This commit is contained in:
parent
b74f563a33
commit
7d1b74a8c6
@ -272,7 +272,7 @@ static float8
|
||||
calculate_jitter_percent()
|
||||
{
|
||||
/* returns a number in the range [-0.125, 0.125] */
|
||||
uint8 percent = random();
|
||||
uint8 percent = rand();
|
||||
return ldexp((double) (16 - (int) (percent % 32)), -7);
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ calculate_next_start_on_failure(TimestampTz finish_time, int consecutive_failure
|
||||
MemoryContext oldctx;
|
||||
/* 2^(consecutive_failures) - 1, at most 2^20 */
|
||||
int64 max_slots = (INT64CONST(1) << (int64) multiplier) - INT64CONST(1);
|
||||
int64 rand_backoff = random() % (max_slots * USECS_PER_SEC);
|
||||
int64 rand_backoff = rand() % (max_slots * USECS_PER_SEC);
|
||||
|
||||
if (!IS_VALID_TIMESTAMP(finish_time))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user