kotlin-ipv8 icon indicating copy to clipboard operation
kotlin-ipv8 copied to clipboard

Use Default dispatcher instead of Main in Community scope.

Open rahimklaber opened this issue 2 years ago • 2 comments
trafficstars

The coroutineScope in the Community class uses Dispatchers.Main. Dispatchers.Main is used to run code on the UI thread and should not be used for anything else.

Code that uses the scope without specifying the Dispatcher when launching a new task (like eva), does not work on a PC, as you need another dependency to access the Main dispatcher. https://github.com/Tribler/kotlin-ipv8/blob/f983ed48ad2bb8d9802b1a9106ef44ce63998664/ipv8/src/main/java/nl/tudelft/ipv8/messaging/eva/EVAProtocol.kt#L74

https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-main.html

rahimklaber avatar Apr 05 '23 21:04 rahimklaber

File Coverage [84.44%] :green_apple:
Community.kt 84.44% :green_apple:
Total Project Coverage 63.11% :green_apple:

github-actions[bot] avatar Apr 05 '23 21:04 github-actions[bot]

Codecov Report

Patch coverage has no change and project coverage change: +0.21 :tada:

Comparison is base (0623f77) 58.32% compared to head (6a40fa2) 58.53%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #79      +/-   ##
============================================
+ Coverage     58.32%   58.53%   +0.21%     
- Complexity      697      702       +5     
============================================
  Files           107      107              
  Lines          4487     4546      +59     
  Branches        634      638       +4     
============================================
+ Hits           2617     2661      +44     
- Misses         1538     1550      +12     
- Partials        332      335       +3     
Impacted Files Coverage Δ
ipv8/src/main/java/nl/tudelft/ipv8/Community.kt 75.78% <ø> (+1.78%) :arrow_up:

... and 7 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Apr 05 '23 21:04 codecov[bot]