Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use parasitic EC in ce2 #65

Merged
merged 1 commit into from
Jan 21, 2021
Merged

Don't use parasitic EC in ce2 #65

merged 1 commit into from
Jan 21, 2021

Conversation

SystemFw
Copy link
Contributor

I used the lib in ce2 for the first time and got deadlock immediately, and found out that the munit ec is parasitic :)

@milanvdm
Copy link
Member

Im not too familiar with parasitic contexts :)

Some questions:

  • Would there be a drawback to move away from the default one provided by munit?
  • Maybe docs will be different?
  • Maybe people actually expect the parasitic one to be the default and would be surprised if they saw the cats-effect one overwrites that?

@SystemFw
Copy link
Contributor Author

SystemFw commented Jan 19, 2021

Just found this out (and replied)

scalameta/munit#134 (comment)

I don't know if the best thing to do here is to override contextShift and timer like I did, or override munitExecutionContext instead (since I've seen that munit does hardcode that in a few places), but having the default be parasitic is definitely not great for cats-effect.

A parasitic Ec is this btw

private val parasiticExecutionContext = new ExecutionContext {
    def execute(runnable: Runnable): Unit = runnable.run()
    def reportFailure(cause: Throwable): Unit = cause.printStackTrace()
  }
def munitExecutionContext: ExecutionContext = parasiticExecutionContext

with no asynchrony/concurrency at all

Maybe people actually expect the parasitic one to be the default and would be surprised if they saw the cats-effect one overwrites that?

note that this PR does not override the munit context for you, it just overrides the cats-effect stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants