Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why can't tasks enqueued during transactions have names?

I just learnt that transactional tasks cannot be named. Why is that? It's as though naming a task is an action on a different entity group, but "unnamed" tasks are actually given api-generated names.

like image 337
v_y Avatar asked Jun 26 '10 09:06

v_y


1 Answers

Task names are unique, so if you add a task named "foo", subsequent adds of tasks named "foo" will fail. This check for uniqueness needs to be done within a transaction itself, so all named tasks in an application would have to have the same entity group.

If you're trying to atomically enqueue tasks within a transaction then the tasks will have to have the same entity group as the other entities in the transaction and uniqueness check would not be reliable.

like image 50
Justin Fagnani Avatar answered Nov 14 '22 06:11

Justin Fagnani