Skip to content

Instantly share code, notes, and snippets.

@pdentener
pdentener / retries.ts
Created December 23, 2019 09:27 — forked from dinvlad/retries.ts
Retries with exponential backoff and jitter for idempotent background Google Cloud Functions
// one can also use Google Cloud Firestore library,
// with a slight change in semantics
import { firestore } from 'firebase-admin';
import { EventContext, runWith } from 'firebase-functions';
import { promisify } from 'util';
const eventCollection = 'function-events';
enum EventStatus {
RUNNING = 'running',