kin-android icon indicating copy to clipboard operation
kin-android copied to clipboard

Possible asynchronous bug in `NetworkOperationsHandlerImpl `.

Open gmpassos opened this issue 3 years ago • 1 comments

operations should be populated before schedule.

This line

operations[id] = op

should be placed before:

ioScheduler.schedule

The only thing that avoids an asynchronous bug is the delay of the operation execution, what is not a correct pattern for synchronized data.

It's possible to have the operation executed before the operations[id] = op write.

https://github.com/kinecosystem/kin-android/blob/07dd33807f505ab9cb04e910760875d367c0b43e/base/src/main/java/org/kin/sdk/base/tools/NetworkOperationsHandler.kt#L224

https://github.com/kinecosystem/kin-android/blob/07dd33807f505ab9cb04e910760875d367c0b43e/base/src/main/java/org/kin/sdk/base/tools/NetworkOperationsHandler.kt#L219

gmpassos avatar May 05 '21 22:05 gmpassos

feel free to submit a pr with your proposed change along side appropriate unit tests

Blahartinger avatar May 27 '21 16:05 Blahartinger