Instead of starting tasks immediately as they’re created instead use a queue to make sure the CPU on the server isn’t overloaded when doing something like converting video or images.
BEAM might actually manage this already, but it warrants some investigation since generating compressed media fails frequently when making posts and it’s unclear why, but I suspect it has something to do with limited resources on the server since regenerating them later works.