4 ms·
> (...) developers just don't do it because it's so difficult. I don't think this is true, or at least generalizable. I've been involved in a few tickets to t
by rewmie 3y ago
> (...) developers just don't do it because it's so difficult.
I don't think this is true, or at least generalizable.
I've been involved in a few tickets to turn problematic sync calls to async calls or background tasks. In all of them, the root cause was the same:
* Let's add a handler that does nothing of note, such as setting a flag or logging something or emitting a metric.
* We have another feature, and it requires something being triggered by the handler. Let's add it next to the logger/metric call. Let's also clean this up and extract a function out of this code.
* We need to tweak that feature to do one more thing. Calling that function from the handler under rare cases can add a bit of lag and block stuff. We can live with it, so let's keep it like that.
* Oh it turns out that member function can render the app unusable. We can't live with it anymore, and we need to refactor it.