chore(socket): remove dead retryCount param from uploadPreKeys
PR #393 review (low-confidence comment): the retryCount parameter and its `=== 0` guard were leftovers from the previous manual recursive backoff. Now that bounded-retry handles retries internally, the recursion is gone and retryCount is always 0. Drop the parameter, remove the guard (the check applies always), and simplify the log statement (no more "retryCount" in the structured data — bounded-retry's own logger logs attempt counts). Build clean, 35/35 suites, 809/809 tests pass.
This commit is contained in:
@@ -612,15 +612,15 @@ export const makeSocket = (config: SocketConfig) => {
|
||||
let lastUploadTime = 0
|
||||
|
||||
/** generates and uploads a set of pre-keys to the server */
|
||||
const uploadPreKeys = async (count = MIN_PREKEY_COUNT, retryCount = 0) => {
|
||||
// Check minimum interval (except for retries)
|
||||
if (retryCount === 0) {
|
||||
const uploadPreKeys = async (count = MIN_PREKEY_COUNT) => {
|
||||
// Check minimum interval. (Previously this was guarded by `retryCount === 0`
|
||||
// because the function recursed on retry; with bounded-retry handling
|
||||
// retries internally there is no recursion and the guard is implicit.)
|
||||
const timeSinceLastUpload = Date.now() - lastUploadTime
|
||||
if (timeSinceLastUpload < MIN_UPLOAD_INTERVAL) {
|
||||
logger.debug(`Skipping upload, only ${timeSinceLastUpload}ms since last upload`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent multiple concurrent uploads — if one is already running, wait for it and return:
|
||||
// the concurrent upload already replenished the pool, so there is nothing left to do.
|
||||
@@ -631,7 +631,7 @@ export const makeSocket = (config: SocketConfig) => {
|
||||
}
|
||||
|
||||
const uploadLogic = async () => {
|
||||
logger.info({ count, retryCount }, 'uploading pre-keys')
|
||||
logger.info({ count }, 'uploading pre-keys')
|
||||
|
||||
// Generate and save pre-keys atomically (prevents ID collisions on retry)
|
||||
const node = await keys.transaction(async () => {
|
||||
|
||||
Reference in New Issue
Block a user