Behaviour of the unique ID argument:
If it's not provided, it defaults to a UUIDv1 (timestamp + mac address).
Otherwise, if a job with the same unique ID exists (i.e. is either queued or currently executing), then that job is used, not the one you're submitting. This does not apply to past (completed) jobs, and works across the entire job server pool, assuming no partitioning.
Or with code (the values in [brackets] are the server-assigned job identifiers):
<?php
$gearman->doBackground('sleep', '3', '123'); $gearman->doBackground('sleep', '5', '456'); $gearman->doBackground('sleep', '3', '123'); $gearman->doBackground('sleep', '1', '123'); sleep (3);
$gearman->doBackground('sleep', '3', '123'); ?>