executor 2.1.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 75

Async task executor for Dart

Executes async tasks with a configurable maximum concurrency and rate.

Usage

A simple usage example:

import 'dart:async';

import 'package:executor/executor.dart';

Future main() async {
  Executor executor = new Executor(concurrency: 10);
  // only 10 of them will be running at a time
  for (int i = 0; i < 20; i++) {
     executor.scheduleTask(() async {
       // await longDatabaseTask()
       // await anotherProcessing()
     });
  }
}

Changelog

2.1.2

  • Using package:stack_trace to chain async stacktraces when task fails.

2.1.1

  • Improved design on loop and scheduling, preserving caller stacktrace with full details.

2.1.0

  • Removed Timers to schedule tasks, using a simple loop instead.
  • Better distribution for rate-limited executions.

2.0.0

  • Supporting Dart 2 only.

1.0.1

  • Dart2 compatibility with package:dart2_constant.

1.0.0

Breaking changes

  • Removed deprecated member limit.
  • Renamed ExecutorTask -> AsyncTask, return value to FutureOr.
  • Renamed Rate.limit -> Rate.maximum.

New features

  • Added Executor.onChange. Clients can use this to monitor the current scheduledCount and queue more tasks to ensure Executor is running on full capacity.

Housekeeping

  • Added example.
  • Added a few tests.

0.1.2

  • Expose internal stats: runningCount, waitingCount, scheduledCount.
  • Enable sync-points with join(), which allows to track the completion of the currently running (and optionally the waiting) tasks.

0.1.1

  • Fix missing heartbeat check on Executor.close(), without it the Future might not have completed.

0.1

  • start-rate limit support
  • renamed limit to concurrency (leaving old field, marked deprecated)

example/example.dart

// Copyright (c) 2017, Agilord. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'dart:async';

import 'package:executor/executor.dart';

Future main() async {
  Executor executor = new Executor(concurrency: 10);
  // only 10 of them will be running at a time
  for (int i = 0; i < 20; i++) {
    executor.scheduleTask(() async {
      // await longDatabaseTask()
      // await anotherProcessing()
    });
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  executor: ^2.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:executor/executor.dart';
  
Version Uploaded Documentation Archive
2.1.2 Sep 24, 2018 Go to the documentation of executor 2.1.2 Download executor 2.1.2 archive
2.1.1 Sep 21, 2018 Go to the documentation of executor 2.1.1 Download executor 2.1.1 archive
2.1.0 Sep 11, 2018 Go to the documentation of executor 2.1.0 Download executor 2.1.0 archive
2.0.0 Aug 12, 2018 Go to the documentation of executor 2.0.0 Download executor 2.0.0 archive
1.0.1 May 12, 2018 Go to the documentation of executor 1.0.1 Download executor 1.0.1 archive
1.0.0 Sep 19, 2017 Go to the documentation of executor 1.0.0 Download executor 1.0.0 archive
0.1.2 May 3, 2017 Go to the documentation of executor 0.1.2 Download executor 0.1.2 archive
0.1.1 May 3, 2017 Go to the documentation of executor 0.1.1 Download executor 0.1.1 archive
0.1.0 Mar 30, 2017 Go to the documentation of executor 0.1.0 Download executor 0.1.0 archive
0.0.4 Jan 1, 2017 Go to the documentation of executor 0.0.4 Download executor 0.0.4 archive

All 13 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:executor/executor.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
stack_trace >=1.9.0 <2.0.0 1.9.3
Transitive dependencies
path 1.6.2
Dev dependencies
test ^1.3.0