Skip to content

Instantly share code, notes, and snippets.

@thakursaurabh1998
Created June 27, 2022 19:37
Show Gist options
  • Save thakursaurabh1998/49337fa3418e90fa8cd5d3971b6b34c5 to your computer and use it in GitHub Desktop.
Save thakursaurabh1998/49337fa3418e90fa8cd5d3971b6b34c5 to your computer and use it in GitHub Desktop.
class Poll {
/**
* @typedef options
* @property {number} interval Interval between each poll in `seconds`
* @property {number} maxPollCount Max number of times to poll
*
* @param {options} options
* @param {(Object) => Boolean} pollingFunction
* @param {QueueClientInterface} queueClient
*/
constructor(
{ interval, maxPollCount },
pollingFunction,
queueClient,
logger = console
) {
this.logger = logger;
this.interval = interval;
this.queueClient = queueClient;
this.maxPollCount = maxPollCount;
this.pollingFunction = pollingFunction;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment