Skip to content

Add product availability windows and sync poller#131

Open
clawrencespace wants to merge 1 commit intomainfrom
feat/product-availability-window
Open

Add product availability windows and sync poller#131
clawrencespace wants to merge 1 commit intomainfrom
feat/product-availability-window

Conversation

@clawrencespace
Copy link
Copy Markdown
Collaborator

Summary

  • add product availableFrom and availableUntil support in API validation and product service
  • add a minute poller that activates newly available inactive products and archives newly expired active products using a 10 minute lookback
  • allow a 5 minute checkout grace period after availableUntil so orders already in flight are less likely to fail at the boundary
  • only auto-activate products that are not already sold out

Notes

  • matches the paired schema/bootstrap PR in mustachebash/development
  • repo-wide test/typecheck is currently not green on main due to pre-existing issues unrelated to this change

Comment thread lib/index.ts
Comment on lines +219 to +226
app.listen(4000, () => {
log.info(`Mustache Bash API ${process.env.npm_package_version} listening on port 4000`);

void runScheduledProductAvailabilitySync();
setInterval(() => {
void runScheduledProductAvailabilitySync();
}, productAvailabilityPollIntervalMs);
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not run this as an interval, and instead use a recursive function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants