Table of Contents

Method TeardownAsync

Namespace
WhalesSecret.TradeScriptLib
Assembly
WhalesSecret.TradeScriptLib.dll

TeardownAsync()

Method that is called once user unloads trade script via front-end application.

Task TeardownAsync()

Returns

Task

A Task representing the asynchronous operation.

Remarks

It is expected that this method correctly awaits till all running trade script instances finish. It may also help them correctly finish sooner.

Before this method is called, cancellation is invoked on all cancellation tokens passed to ExecuteAsync(string, CancellationToken), so that particular execution tasks, if there are any, are informed about the initiation of the teardown. That, however, does not mean the execution tasks are finished when this method is called. Rather they are executing in parallel and it is up to the author of the script to decide how proper teardown should be implemented.

Also there is a timeout that the hosting environment imposes on the whole teardown process, which includes both cancellation of all running execution tasks, if there are any, and completion of execution of this method. Hence once the teardown is announced, it should complete as soon as possible.