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

Rework load status and add failover implementation #585

Closed
wants to merge 14 commits into from

Conversation

PaulPickhardt
Copy link
Member

If available, link to the ticket

Closes: #561
Closes: #562

QA Checklist

Author

  • Code Review
  • Functionality Tested (iOS and Android + different screens)
  • Light/Dark Mode Tested
  • Performance/Energy Consumption Tested (especially in ride view)

Reviewer

  • Code Review
  • Functionality Tested (iOS and Android + different screens)
  • Light/Dark Mode Tested
  • Performance/Energy Consumption Tested (especially in ride view)

@PaulPickhardt PaulPickhardt changed the title Feature/load status rework Rework load status and add failover implementation Jun 7, 2024
@adeveloper-wq
Copy link
Member

After failover to production we need to decide on how we want to handle a potential high load in the production backend. Shall we switch to release again? Shall we stay at production? Shall we restrict app access?

import 'package:priobike/http.dart';
import 'package:priobike/logging/logger.dart';
import 'package:priobike/main.dart';
import 'package:priobike/settings/models/backend.dart';
import 'package:priobike/settings/services/settings.dart';

// TODO maybe send these values from the load service.
Copy link
Member

Choose a reason for hiding this comment

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

I'd also argue for that. Setting those values on the client makes it harder for us to update them and I don't see an advantage in setting them on the client instead of at the load service.

Furthermore, do we need the actual load values on the client or would it also be enough to just send a bool to the client stating whether our backend is overloaded right now or not?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I agree. I just wanted your confirmation on that before implementing it.

/// Sends an app start notification to the load service in the backend.
Future<void> sendAppStartNotification() async {
/// Fetches the status data from the priobike-load-service for release and production and decides whether the failover (production) should be used.
Future<bool> shouldUseFailover() async {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need both the fetch() and the shouldUseFailover methods?

lib/loader.dart Outdated
Comment on lines 83 to 86
await FCM.selectTopic(settings.backend);
} else {
await settings.setBackend(Backend.release);
await FCM.selectTopic(settings.backend);
Copy link
Member

@adeveloper-wq adeveloper-wq Jun 14, 2024

Choose a reason for hiding this comment

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

I think it would make more sense to keep the News Service and FCM always in Release mode. If they are not reachable because of overloading its not that problematic. Production and Release, however, diverge content-wise and therefore are not easily interchangeable.

@PaulPickhardt PaulPickhardt marked this pull request as ready for review June 20, 2024 11:15
@adeveloper-wq
Copy link
Member

Continued here: #613

@adeveloper-wq adeveloper-wq deleted the feature/load-status-rework branch June 25, 2024 12:08
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.

Implement failover based on new load status Implement better load warning based on new load service status
2 participants