Queued Scripting Working Inconsistently

I’m trying to get a queued script to work and have read the 3 documents in the wiki and 4 posts on this.

If I only select ‘Queue For Later Execution’, it processes synchronously.
If I set the connection to ‘database’ it immediately returns a 202 response with
“success”: true

However, my script never gets executed.
I’m checking the jobs table and nothing is stored in there.
If I remove queue for later execution it works fine every time and takes about 6 seconds to run

It doesn’t seem to run unless I run php artisan queue:listen database on the command line (not sure if you are supposed to do that when you start the server every time)

When I do run php artisan queue:listen database it processes but sometimes doesn’t complete the task and it doesn’t show up in the failed scripts.

Here’s the articles that I’ve looked at:

Also occasionally I run or edit my script and get a weird error that it can’t write to the file:
“file_put_contents(/opt/dreamfactory/storage/framework/cache/data/10/a3/10a34637ad661d98ba3344717656fcc76209c2f8): failed to open stream: Permission denied”