Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Core): gracefully shutdown router/scheduler if Redis is unavailable #891

Merged
merged 19 commits into from
Apr 24, 2023

Conversation

prajjwalkumar17
Copy link
Contributor

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates

Description

The change will from now allow the server to gracefully shutdown once the redis goes down. We are passing the tx and rx using a Oneshot::channel() for redis . It has a suitable receiver to stop the server once the tx is received.

Additional Changes

  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

As the core Server wasn't shutting down whenever redis goes down and rather that going down with it. Server stayed there throwing health is good and then sending errors when hitting other routes.
Now the server gracefully goes down too once the redis goes down

How did you test it?

Tested it manually as we just need to check whether or not the server is shutting down on redis stopping

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@prajjwalkumar17 prajjwalkumar17 added A-core Area: Core flows A-performance Area: Performance optimisation labels Apr 16, 2023
@NishantJoshi00 NishantJoshi00 added the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Apr 17, 2023
@NishantJoshi00
Copy link
Member

Hey @prajjwalkumar17, please setup commit verification and enforce it through github

crates/common_utils/src/pii.rs Outdated Show resolved Hide resolved
crates/drainer/src/lib.rs Outdated Show resolved Hide resolved
crates/redis_interface/src/lib.rs Outdated Show resolved Hide resolved
crates/router/src/scheduler/consumer.rs Outdated Show resolved Hide resolved
crates/router/src/scheduler/consumer.rs Outdated Show resolved Hide resolved
This was linked to issues Apr 17, 2023
@SanchithHegde SanchithHegde changed the title Feat/gracefull shutdown feat: gracefully shutdown router/scheduler if Redis is unavailable Apr 17, 2023
crates/router/src/lib.rs Outdated Show resolved Hide resolved
crates/router/src/bin/scheduler.rs Outdated Show resolved Hide resolved
crates/router/Cargo.toml Outdated Show resolved Hide resolved
crates/router/src/lib.rs Outdated Show resolved Hide resolved
@SanchithHegde SanchithHegde added C-feature Category: Feature request or enhancement S-waiting-on-author Status: This PR is incomplete or needs to address review comments and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Apr 17, 2023
dracarys18
dracarys18 previously approved these changes Apr 20, 2023
NishantJoshi00
NishantJoshi00 previously approved these changes Apr 20, 2023
jarnura
jarnura previously approved these changes Apr 20, 2023
@jarnura jarnura added S-ready-for-merge and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Apr 20, 2023
@jarnura jarnura added this pull request to the merge queue Apr 20, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Apr 20, 2023
@jarnura jarnura added S-waiting-on-author Status: This PR is incomplete or needs to address review comments S-needs-conflict-resolution Status: This PR needs conflicts to be resolved by the author labels Apr 21, 2023
@prajjwalkumar17 prajjwalkumar17 added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed and removed S-waiting-on-author Status: This PR is incomplete or needs to address review comments S-needs-conflict-resolution Status: This PR needs conflicts to be resolved by the author labels Apr 21, 2023
@jarnura jarnura removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Apr 24, 2023
@jarnura jarnura added this pull request to the merge queue Apr 24, 2023
Merged via the queue into main with commit 1318599 Apr 24, 2023
@SanchithHegde SanchithHegde deleted the feat/gracefullShutdown branch April 24, 2023 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows A-performance Area: Performance optimisation C-feature Category: Feature request or enhancement
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

5 participants