Skip to content

Timer.periodic() stacks and fired a lot of events at once after computer resumes from long sleep (server-side) #23487

@DartBot

Description

@DartBot

This issue was originally filed by tomy...@potix.com


For example, run the following code and put the machine to sleep for a while and wake it up. You'll find a lot of events fired at once.

import "dart:async";

void main() {
  new Timer.periodic(const Duration(seconds:1), (_) {
    print(">>${new DateTime.now()}");
  });
}

Of course, it still follows the spec. However, I don't think it is good since it means the developers have to filter out such kind of extra events to avoid choke up the computer.

BTW, JavaScript on Chrome implements setInterval() differently -- it fires only once (after resumed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.core-2library-asynctype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions