![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
backoff-pool
Advanced tools
A helper library to manage expotential backoff intervals of different resources.
A helper library to manage expotential backoff intervals of different resources.
This can be used to manage retry interval of login attempts per IP address and apply rate limit on abnormal request / rare API calls.
npm install backoff-pool
import from typescript:
import { BackoffPool } from 'backoff-pool'
Or import from javascript:
const { BackoffPool } = require('backoff-pool')
export class BackoffPool<Key = string | number> {
constructor(options?: BackoffPoolOptions)
success(key: Key): void
fail(key: Key): void
applyRandomBackoff(key: Key, range?: number): void
getInterval(key: Key): number
getUnlockTime(key: Key): number | undefined
isLocked(key: Key): boolean
isAvailable(key: Key): boolean
}
export interface BackoffPoolOptions {
defaultInterval?: number // default 0
initialBackoffInterval?: number // default 1 second
maxBackoffInterval?: number // default unlimited
backoffFactor?: number // default 2
randomBackoffRatio?: number // default 0.2 (20%)
}
export let defaultBackoffPoolOptions: Required<BackoffPoolOptions>
let backoffPool = new BackoffPool({
defaultInterval: 0,
initialBackoffInterval: 2000,
backoffFactor: 2,
})
let clientIP = 'stub'
console.log('0', backoffPool.isAvailable(clientIP)) // true: is available
console.log('0', backoffPool.isLocked(clientIP)) // false: not locked
console.log('0', backoffPool.getUnlockTime(clientIP)) // undefined: not locked
backoffPool.fail(clientIP) // lock for 2 seconds
console.log('1', backoffPool.isAvailable(clientIP)) // false: not available
console.log('1', backoffPool.getUnlockTime(clientIP)) // Date.now() + 2000
backoffPool.fail(clientIP) // failed again, lock for 4 seconds
backoffPool.fail(clientIP) // failed again, lock for 8 seconds
console.log('2', backoffPool.getInterval(clientIP)) // 8000: 8 seconds
await sleep(7 * 1000)
console.log('7', backoffPool.isAvailable(clientIP)) // false: still locked
await sleep(1 * 1000)
console.log('8', backoffPool.isAvailable(clientIP)) // true: unlocked now
backoffPool.success(clientIP) // reset the interval
console.log('9', backoffPool.getInterval(clientIP)) // 0: same as defaultInterval
backoffPool.fail(clientIP) // lock for 2 seconds instead of 16 seconds
await sleep(2 * 1000)
console.log('10', backoffPool.isLocked(clientIP)) // false: unlocked now
More examples see test/example.ts and test/core.test.ts
This project is licensed with BSD-2-Clause
This is free, libre, and open-source software. It comes down to four essential freedoms [ref]:
FAQs
A helper library to manage expotential backoff intervals of different resources.
We found that backoff-pool demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.