Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import got from 'got';
- import notifier from 'node-notifier';
- const url = "";
- function msleep(n) {
- Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, n);
- }
- function sleep(n) {
- msleep(n*1000);
- }
- const log = (msg) => {
- console.log(new Date(), msg)
- }
- const main = async () => {
- log("Running");
- while(true) {
- const response = await got(url);
- const {statusCode} = response;
- if (statusCode !== 200){
- notifier.notify(`Invalid status code: ${statusCode}`)
- log(`Result: ${statusCode}`);
- }
- sleep(1);
- }
- }
- main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement