squadron 4.3.8 squadron: ^4.3.8 copied to clipboard
Multithreading and worker thread pool for Dart / Flutter, to offload CPU-bound and heavy I/O tasks to Isolate or Web Worker threads.
4.3.8 #
- Downgrade
meta
version to^1.8.0
to matchflutter_test
requirements (fix for https://github.com/d-markey/squadron/issues/18).
4.3.7 #
- Ensure uniqueness of cancellation token IDs across workers (breaking change for classes implementing/deriving from
CancellationToken
:id
is now aString
).
4.3.6 #
- Downgrade
meta
version to^1.8.0
to matchflutter_test
requirements. - Fix pool scheduler algorithm to ensure worker availability before dispatching tasks.
4.3.5 #
- Add
UseLogger
annotation to have package squadron_builder generate the associated code in worker threads.
4.3.4 #
- Add notifications when a worker is added or removed. Interested components can register listeners (callbacks) for these notifications.
- Disable automatic log-forwarding between workers and their parents. It is possible to restore this behaviour manually by using [ParentSquadronLogger] as a logger during initialization of the platform worker.
- Split logging logic between message formatting vs. emitting.
4.3.3 #
- Rename
SquadronSerializer
toSquadronMarshaller
. - Update dev dependencies.
4.3.2 #
WorkerResponse
: ifresult
is anIterable
but not aList
, calltoList()
to get results before serializing the response back to the caller.SerializeWith
: annotation used to indicate how to marshal data to/from a service running in a Worker. See alsoSquadronSerializer
class.
4.3.1 #
CancellationToken
: provideFuture<bool> isCancelled({bool throwIfCancelled = false})
to make it easier to check cancellation token status in worker services.
4.3.0 #
ValueWrapper
: check future hasn't already completed before callingcomplete()
orcompleteError()
.
4.2.0 #
- Add
baseUrl
parameter toSquadronService
annotation.
4.1.0 #
- Now with annotations to support code generation. To be used with package
squadron-builder
.
4.0.0 #
- Breaking changes: all deprecated artefacts have been removed.
- Breaking change:
LocalSquadronLogger
has been deleted. - Breaking change: the
args
andtoken
arguments of methodssend()
andstream()
are now named argument. - Breaking change: removed the optional
id
parameter that was passed toWorker
constructors. - Breaking change: disabled message inspection for Web channels. In previous versions, Squadron would inspect each piece of data exchanged via
_JsChannel
s to identify objects whose ownership must be transfered to the receiving end (thetransfer
argument inpostMessage
). However most of the time, the request / response objects are usually made ofList
,Map
, and base types, all of which can cross thread boundaries "as-is". This behavior is now controlled by optional parametersinspectRequest
andinspectResponse
of methodsWorker.execute()
andWorker.stream()
, defaulting tofalse
thus disabling message inspection. Passingtrue
will activate message inspection for request and/or response and will be necessary when the message contains an object whose ownership must be transfered to the receiving end, typicaly aMessagePort
. Basic testing found message transfer time improvement around ~5-10% for large payloads, e.g. aList
containing manyMap
items (note that in Web scenarios, JSON serialization could prove a more efficient alternative). It should have little to no effect on smaller messages. Start requests will always be processed withinspectRequest = true
andinspectResponse = true
. - Fixed issue with workers on native platforms: ensure all
ReceivePorts
are closed uponIsolate
termination. - Support logging accross workers (which made
LocalSquadronLogger
obsolete). - Added support to reset the Squadron singleton.
- Reworked examples & unit tests.
3.4.0 #
- Rewritten streaming implementations (fix for https://github.com/d-markey/squadron/issues/8).
- Added unit tests.
3.3.2 #
- Implemented a
LocalLogger
to have Web workers log messages from the main window (effectively logging via Dart debugger if present). - Removed import of
dart:isolate
from_worker_runner.dart
. - Made
coverage
a dev dependency. - Added a tool to extract coverage metrics during Github Dart workflow.
- Updates badges to include coverage metrics and platform info.
3.3.1 #
- Fixed streaming from
LocalWorker
. - Added tests for
LocalWorker
. - Improved cancellation handling.
- Added tests to improve test coverage.
3.3.0 #
- Implemented
LocalWorker
, a worker-like class living in the same thread as its owner and available for inter-worker messaging. For instance, in a Flutter app, instantiating aLocalWorker
in the main thread enables other workers to (indirectly) call Flutter APIs that are otherwise not available in the context of a secondary thread. LocalWorker
uses the same concepts and approach asWorkers
, such as theoperations
map and theWorkerService
interface.
3.2.2 #
- Document types and release mode (special thanks to SwissCheese5).
- More error handling at communication points.
- Use lower log levels for internal Squadron log messages.
- Added test coverage.
3.2.1 #
- Document the new logging feature.
- Make
sendRequest()
async in browserChannel
(implementation closer to that of nativeChannel
). - Add a timestamp to pool workers to record the time when it was assigned its last task.
- Sort pool workers to distribute tasks to those that have the largest capacity and the oldest timestamp.
- Add command property to
WorkerException
. - Reorganized the test folder.
- Recompiled test Web workers.
3.2.0 #
- Added a logging mechanism to facilitate debugging Squadron's internals.
- Reworked connection flow between main program and worker.
- Reworked task scheduling.
- Fixed issue https://github.com/d-markey/squadron/issues/3.
- Added tests for logging and workers failing to initialize.
3.1.4 #
- Implemented cancellation token to enable worker task notification that cancellation has occured.
- Implemented
TimeOutToken
,CancellableToken
andCompositeToken
. - Updated
README.md
. - Added unit tests.
3.1.0 #
- Several minor changes (some possibly breaking changes but easy to fix).
- Split library into
squadron_service.dart
(worker services only),squadron_worker.dart
(worker services and workers without pool) vs.squadron.dart
(worker services, workers and pools). - Split
Channel
intoChannel
(used to send aWorkerRequest
) andWorkerChannel
(used to send aWorkerResponse
). - Added
ConcurrencySettings
to eventually replaceminWorkers
,maxWorkers
andmaxParallel
. - Added
WorkerPool.execute()
(will eventually replaceWorkerPool.compute()
). - Added
WorkerPool.scheduleTask()
to schedule aValueTask
. Result will be accessible from futureValueTask.value
. - Added
WorkerPool.scheduleStream()
to schedule aStreamTask
. Results will be accessible from streamStreamTask.stream
. ValueTask
andStreamTask
provide information on task execution (eg. status, wait time, execution time...).- Added
WorkerPool.cancel()
to support worker task cancellation. - Updated
README.md
. - Added unit tests.
3.0.0 #
- Split library into
squadron_service.dart
(worker services only),squadron.dart
(worker services and workers without pool) vs.squadron_pool.dart
(worker services, workers and pools). - Moved
connect()
andprocess()
from Worker to WorkerService. - Provided the
run()
function to facilitate implementation of platform workers. - Adapted tests and examples.
- Updated
README.md
.
2.0.2 #
- Single test code base for both platforms.
- Added BitCoin service to test live network access from workers (courtesy of coindesk.com).
- Added PiDigits service (related to https://github.com/d-markey/squadron/issues/1).
- Retaining attempts based on manually operating a browser to run tests in /web (different test code base) and /test/browser-tests (same test code base).
2.0.1 #
- Remove dependency on js package.
2.0.0 #
- This version supports workers running in Isolates as well as Web Workers.
- Platform implementations are now more straightforward thanks to
Worker.connect()
andWorker.process()
. - See examples on how to scaffold services, Squadron Workers and platform workers.
- Added tests for Web Workers (run with
dart run build_runner serve -r
and point your browser to http://localhost:8080/index.html).
1.0.2 #
- Added support for minimum count of workers in pool.
- Make sure Isolate is killed when the worker is stopped.
- Keep track of stats from stopped workers.
- Update tests & examples (proper error handling, command map, worker monitoring).
1.0.1 #
- Improve error handling.
- Improve documentation.
- Add unit tests.
1.0.0 #
- Initial version.