Git Product home page Git Product logo

eamuse-maintenance-bot's People

Stargazers

 avatar

Watchers

 avatar  avatar

eamuse-maintenance-bot's Issues

if app crashes, extendedMaintenancePostedFlags all get reset to false

Expected Behavior

If the clock lands 1 days before Extended Maintenance, specifically at 11:00 am ET / 12:00 am jst:

  • is1DaybeforeExtendedMaintenance will set to true.
  • Tweet will be posted because extendedMaintenancePostedFlags.posted24HourWarning is false.
  • extendedMaintenancePostedFlags.posted24HourWarning will be set to true.

If the app crashes, the tweet should not post again and should wait for the next checkpoint, extendedMaintenancePostedFlags.posted2HourWarning

Actual Behavior

If the app crashes & reboots, assuming the 1 day warning has been posted already:

  • is1DaybeforeExtendedMaintenance will be re-initialized to false.
  • Tweet will attempt to post again
  • Twitter returns a "duplicate status" rejected attempt, closing connection to the API. This causes extended downtime on the bot.
  • App crashes, repeats cycle

Steps to reproduce bug

  1. Allow a warning tweet to be posted, e.g. 11AM ET for the 2 hour warning
  2. End the Express instance
  3. Set clock to 10:58AM ET and restart the Express instance
  4. Take note of Twitter's "duplicate status" rejected attempt

example crash logs from a 1 day warning double post

2022-10-17T02:06:31.246937+00:00 app[worker.1]:     'x-response-time': '102',
2022-10-17T02:06:31.246937+00:00 app[worker.1]:     'x-connection-hash': '2a0792015ff665fb2086d0ae79c31bfb53bbd67f7dac7ec7c89181fa28ec373e',
2022-10-17T02:06:31.246937+00:00 app[worker.1]:     connection: 'close'
2022-10-17T02:06:31.246938+00:00 app[worker.1]:   },
2022-10-17T02:06:31.246938+00:00 app[worker.1]:   rateLimit: undefined,
2022-10-17T02:06:31.246938+00:00 app[worker.1]:   data: { errors: [ { code: 187, message: 'Status is a duplicate.' } ] },
2022-10-17T02:06:31.246938+00:00 app[worker.1]:   errors: [ { code: 187, message: 'Status is a duplicate.' } ]
2022-10-17T02:06:31.246939+00:00 app[worker.1]: }
2022-10-17T02:06:31.403329+00:00 heroku[worker.1]: Process exited with status 1
2022-10-17T02:06:31.503170+00:00 heroku[worker.1]: State changed from up to crashed

Specs

Version: Express 4.18.2
Platform: Heroku

Suggestions

Write and load the extendedMaintenancePostedFlags to/from an external file so that state is preserved
AND OR
Guard the postTweet function with an additional condition; one that checks that it is no more than a minute past the time. For example,

const is2HoursBeforeExtendedMaintenance = isTodayExtendedMaintenance && extendedMaintenanceDay.getUTCHours() === 0 && currentDate.getMinutes() < 1;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.