Transfer-service should stop executing aborted/abandoned requests
The transfer-service service should stop executing SQL queries and message generation of submitted requests when the client has closed the connection/socket.
So that resources are used as efficiently as possible and allow serving more requests.
Technical notes
It will also ensure long running connections are not left open by mistake.
- In this ticket #278 (closed), we have introduced CancellationTokens, propagated all the way to the long running sql statements in the transfer-service.
- When the cancellationToken is Cancelled, the SQL statement is closed in the middle of the execution, and an error is thrown stopping the whole process.
- In the transfer-service the cancellationToken can be cancelled either by the service shutting down or by the config parameter DataImportTimeOutInMinutes.
- For the case of the
/status/request
and/status/requests
the CancellationToken can come directly from the rest request into the controller, if the user refreshes the browser (I am not sure if closing it), the CancellationToken is marked as Cancelled. Later, this functionality can also be extended to all the transfer service methods. - This cancellationToken can also be cancel after a given time (by configuration) using the CancelAfter.
IMPORTANT: The issue should be addressed together with these tickets:
Edited by Pedro Carranza