From 10478981fadf0d0468e03f8a2af89194e1d2caf9 Mon Sep 17 00:00:00 2001 From: rtmigo Date: Sun, 18 Apr 2021 01:02:51 +0300 Subject: [PATCH 1/4] docs --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 40b6bd5..44eed9b 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # schedulers -Objects in this library run callbacks asynchronously, allowing useful pauses -between calls. This can be used for load balancing, rate limiting, lazy execution. +A library for running asynchronous functions on time. This can be used for +load balancing, rate limiting, lazy execution. -In the examples below, objects receive tasks immediately after +*In the examples below, objects receive tasks immediately after constructors. But in fact, objects can handle calls to the `run` method -at random times. The tasks will be distributed in time in the same way. +at random times. The tasks will be distributed in time in the same way.* # IntervalScheduler From c575f823548ff2b8278a30f8253b932341e199d3 Mon Sep 17 00:00:00 2001 From: rtmigo Date: Sun, 18 Apr 2021 01:04:55 +0300 Subject: [PATCH 2/4] docs --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44eed9b..ecc3eaf 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ A library for running asynchronous functions on time. This can be used for load balancing, rate limiting, lazy execution. *In the examples below, objects receive tasks immediately after -constructors. But in fact, objects can handle calls to the `run` method -at random times. The tasks will be distributed in time in the same way.* +constructors. But in fact, the `run` method can be run at random times. The +tasks will be distributed in time in the same way.* # IntervalScheduler From 532a972b8629d3713aeabef598e3cd62a84e9bbb Mon Sep 17 00:00:00 2001 From: rtmigo Date: Sun, 18 Apr 2021 01:08:33 +0300 Subject: [PATCH 3/4] docs --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ecc3eaf..35b2986 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ A library for running asynchronous functions on time. This can be used for load balancing, rate limiting, lazy execution. -*In the examples below, objects receive tasks immediately after -constructors. But in fact, the `run` method can be run at random times. The -tasks will be distributed in time in the same way.* +*In the examples below, all the `run(callback)` calls are performed right +after object creation. But it fact all the schedulers are ready to handle +`run` calls at random moments.* # IntervalScheduler From 548c2bec7561d4e10964340ee0625d6f1f87d09a Mon Sep 17 00:00:00 2001 From: rtmigo Date: Sun, 18 Apr 2021 01:21:28 +0300 Subject: [PATCH 4/4] release --- CHANGELOG.md | 2 +- README.md | 2 +- lib/src/50_interval.dart | 2 ++ lib/src/50_lazy.dart | 2 ++ lib/src/50_rateLimiting.dart | 2 ++ pubspec.yaml | 4 ++-- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1995b4a..3c57fdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -# 0.1.0+0-alpha +# 0.1.0+1-alpha - Initial release diff --git a/README.md b/README.md index 35b2986..cc40507 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # schedulers -A library for running asynchronous functions on time. This can be used for +Dart library for running asynchronous functions on time. Useful for load balancing, rate limiting, lazy execution. *In the examples below, all the `run(callback)` calls are performed right diff --git a/lib/src/50_interval.dart b/lib/src/50_interval.dart index 6c3b00a..2bbd862 100644 --- a/lib/src/50_interval.dart +++ b/lib/src/50_interval.dart @@ -31,6 +31,8 @@ class IntervalScheduler implements PriorityScheduler { Future get completed => this._completer.future; + /// Notifies the scheduler that it should run the callback sometime. The actual call will occur + /// asynchronously at the time selected by the scheduler. @override Task run(GetterFunc callback, [int priority = 0]) { if (this._tasks.length <= 0) { diff --git a/lib/src/50_lazy.dart b/lib/src/50_lazy.dart index 3d9d03a..6804fdf 100644 --- a/lib/src/50_lazy.dart +++ b/lib/src/50_lazy.dart @@ -20,6 +20,8 @@ class LazyScheduler { Unlimited _newestRunId = Unlimited(); + /// Notifies the scheduler that it should run the callback sometime. The actual call will occur + /// asynchronously at the time selected by the scheduler. void run(GetterFunc callback) async { this._callback = callback; diff --git a/lib/src/50_rateLimiting.dart b/lib/src/50_rateLimiting.dart index c747e9c..dff8207 100644 --- a/lib/src/50_rateLimiting.dart +++ b/lib/src/50_rateLimiting.dart @@ -29,6 +29,8 @@ class RateScheduler implements PriorityScheduler { final Queue _recentTimes = Queue(); + /// Notifies the scheduler that it should run the callback sometime. The actual call will occur + /// asynchronously at the time selected by the scheduler. @override Task run(GetterFunc callback, [int priority = 0]) { Task? result; diff --git a/pubspec.yaml b/pubspec.yaml index ed80176..ac078a5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,8 +1,8 @@ name: schedulers -description: Running callbacks asynchronously, with useful pauses between calls. +description: Dart library for running asynchronous functions on time. Useful for load balancing, rate limiting, lazy execution. repository: https://github.com/rtmigo/schedulers -version: 0.1.0+0-alpha +version: 0.1.0+1-alpha environment: sdk: ">=2.12.0 <3.0.0"