How to find and kill an application-supervised, static (unnamed) Task in ExUnit (but only for some tests)?

Okay, well, this post seems to imply that long-running Tasks are almost an anti-pattern, and you should instead use a genserver: Best way to name permanent tasks? - #8 by ityonemo

The TL;DR as it applies to my issue involves using Process.register inside the Task module, so it’s named. And, also, to probably not use a Task, and instead use a GenServer.

I will attempt to rewrite my Task as a GenServer. It seems a bit like overkill, but maybe the added functionality potential will serve me well in the long run. What do you think @LostKobrakai ?

1 Like