Skip to content

BUG: Performance Degradation & Notification Flooding due to Side-Effects in build #442

Description

@sandy4242

@andoriyaprashant

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Inside the build method of OpsoTimeLineScreen (which is a StatelessWidget), the code loops through all timeline events and schedules notifications via NotificationService.scheduleNotificationsForEvent

Now the impact it is causing is the build method in Flutter can run many times (on rotation, theme change, parent widget rebuilds). Running asynchronous side-effects here will trigger multiple duplicate scheduling commands. Because notification IDs are generated using a timestamp (DateTime.now().millisecondsSinceEpoch), this stacks up hundreds of duplicate notifications, causing system slowdowns and eventually flooding the user with identical notifications when they trigger

Suggested fix :
Shift notification scheduling out of the build method. It should either be triggered once at app startup (e.g., inside main.dart) or using a dedicated initialization check. Use static notification IDs based on a hash of the event title/date to overwrite previous updates rather than generating a new ID each time.

Record

  • I agree to follow this project's Code of Conduct
  • I'm a GSSOC'24 contributor
  • I want to work on this issue

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions