05nelsonm / kmp-tor

Kotlin Multiplatform Library for embedding Tor into your applications
Apache License 2.0
33 stars 5 forks source link

Add delayed stop for `TorCtrl.Processor` #378

Closed 05nelsonm closed 3 months ago

05nelsonm commented 4 months ago

When processing commands, if there are no more commands to process the processor stops. This can be wasteful and should retry when dequeing commands a few times with a back-off delay, then stop.

05nelsonm commented 3 months ago

So, functionally, if consumer is utilizing either all Async or Sync functionality, this will require at least a 500ms delay to be had between when a job is queued, and the processor shuts down. It is therefore more optimal to stop the processor when there are not enqueued jobs and release the resources.

If they are utilizing callbacks or queuing jobs from multiple threads, then the processor will still work as expected in a FIFO fashion.