Hacker News new | ask | show | jobs
by sergF 105 days ago
Yeah, this is pretty much what I end up doing as well.

It works, but I keep rewriting the same task table / locking / retry logic in every project, which is why I'm wondering if it makes sense to move this out into a separate service.

Not sure if it's actually a real problem or just my workflow though.

1 comments

I would create a library, make some logic more generic, create a generic table (task id, taskType, workerId, etc), store task metadata as jsonb so it can be pulled and marshalled into typed data by users.

Import it into your projects.

Make the library work standalone. But also build a task manager service that people can deploy if they want to run it outside their code.

Then offer a hosted solution that does the webhooks.

I’m sure someone will want to pay for it.

That makes sense, and this is actually close to what I keep ending up with in different projects.

I usually start with something simple, then add a task table, then locking, retries, then some kind of worker process, and eventually it turns into a small job system anyway.

At some point it starts feeling like I'm rebuilding the same queue/worker setup over and over, which is why I'm wondering if this should live outside the app entirely.

Thanks, this discussion is really helpful.