Releases: mstephen19/nanolith
Releases · mstephen19/nanolith
Stability
Removed
__beforeServiceTask
and__afterServiceTask
hooks in favor of universal__beforeTask
and__afterTask
hooks with new context.
Changed
- README streaming examples to use
.shift()
instead of.splice()
. - Context of
TaskHook
s to contain the name of the task being called and whether or not it's being called within a service. ServiceCluster.launch
to disallow negative or non-whole numbers.- Rename
parent
toMainThread
, which makes much more sense anyways since the parent thread is always the main thread in Nanolith. - Rename
messengers
toMessengerList
. - Rename
MessengerList.seek()
toMessengerList.list()
. - General overall refactor + minor performance improvements.
- README revamp.
Fixed
__afterTask
hook being called after the returned value was posted back to the main thread instead of before.- Weird exclusion of
HookDefinitions
keys inTasks
type. - Needing to close all
SharedMap
instances, otherwise the thread would hang even if nothing else is happening. - Errors when initializing
SharedMap
with an empty object.
Added
- Functionality for setting new keys on
SharedMap
instances rather than throwing an error. - The ability to set new values on
SharedMap
based on the previous value. This is fantastic for high-concurrency parallel operations and eliminates all race conditions. Nanolith.clusterize
method for easy creation of a service cluster and launching services all at the same time.
Sharing is caring
Features 🆕
SharedMap
API for sharing memory between threads.notifyAll()
method toServiceCluster
for sending a message to all services on the cluster.- Support for
NodeNext
module resolution.
Fixes & improvements 🛠️
- Add a timeout of 15 seconds to allow a stream to be accepted before the promise is rejected with
createStream()
onMessenger
. - Change
TaskWorkerOptions
andServiceWorkerOptions
types to be exported asLaunchTaskOptions
andLaunchServiceOptions
instead. - Export
SharedArrayPair
,MessengerTransfer
, andSharedMapTransfer
types. - Switch
messenger.transfer()
to be a getter property instead of a method. - Change
pool.option
to be a static property.
Messenger to the rescue
Features 🆕
- Streaming data between the main thread and a service.
- Streaming data between threads with
Messenger
- Replaced
offMessage()
with listener-remover functions returned fromonMessage()
calls
Fixes & improvements 🛠️
MessengerTransferObject
issues within__initializeService()
hook calls- Minor performance improvements to
Messenger
Streams are nice
Features 🆕
waitForMessage()
method onMessenger
andService
- Streaming data between threads!
Fixes & improvements 🛠️
parent.waitForMessenger()
not working when registered in an__initializeService()
hook call.
All patched up
Features 🆕
- Added automatically generated identifiers to the
define()
function. Manually providing them is still possible, but no longer necessary. - Removed
messages
object in favor of the new identicalmessengers
object. - Removed
launchService()
onServiceCluster
in favor of the newlaunch()
method.
Fixes & improvements 🛠️
- Eradicated the
maxListeners
error when calling a high volume of tasks on aService
. - Various performance improvements.
- Lowered bundle size by disabling declaration map files.
Performance Matters
Features 🆕
TaskDefinitions
,Nanolith
,TaskWorkerOptions
, andServiceWorkerOptions
types now available at the top-level.closeAll()
andsetRef()
methods onMessenger
.- Deprecated
messages
object in favor of the new identicalmessengers
object. - Deprecated
launchService()
onServiceCluster
in favor of the newlaunch()
method.
Fixes & improvements 🛠️
- Large performance improvements for
ServiceCluster
. - Slight performance improvements for
Service
. - Slight performance improvements for
Messenger
. - Disabled the max-listeners memory leak warning for all
Worker
instances (this is temporary).
The Polished Pearl
Added
activeCalls
property toService
+ docs.__beforeServiceTask
and__afterServiceTask
hooks + docs.safeMode
option toDefineOptions
+ docs.- "License" section to the README
Changed
- Fixed various typos in README and JSDoc comments + general improvements.
- Removed
calling
andcalled
events fromService
. - Same-file calling to be handled on the
define()
level instead of withinrunTaskWorker
orrunServiceWorker
. - Description in package.json to "Multithreaded nanoservices in no time with seamless TypeScript support."
- "About" section in README.
Captain's Hooks
Features
- Support for an automatically called
__initializeService
hook when launching a service. - Support for new
__beforeTask
and__afterTask
hooks when calling a task. closeAllIdle()
method andcurrentServices
property onServiceCluster
.- Support for an
identifier
parameter in the.use()
method onServiceCluster
. threadID
and rawworker
properties now available onService
instances.- New
waitForMessage()
function underparent
. - New
seek()
function undermessages
.
Fixes
- Possible EventEmitter memory leak detected error (thrown from
Worker
instances when calling many tasks on a service) fixed by cleaning up all listeners and increasing the limit withsetMaxListeners
.
Service-mania
After making some final improvements and fixes on the 0.0.1 beta releases, I'm extremely proud to announce the first stable and ready-to-go version of Nanolith - v0.1.0
.
This version brings a new feature to the table - ServiceCluster
, which allows you to manage and allocate task loads amongst multiple services with just a few lines of code.
Busty Beta
0.0.1-beta3 docs(readme): typo