# Queued Scripting Working Inconsistently

**URL:** <https://community.dreamfactory.com/t/queued-scripting-working-inconsistently/4996>\
**Category:** Server-Side Scripting\
**Created:** [July 29, 2019, 3:49pm UTC](https://community.dreamfactory.com/t/queued-scripting-working-inconsistently/4996 "2019-07-29T15:49:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CrystalTaggart](https://avatars.discourse-cdn.com/v4/letter/c/67e7ee/32.png) [@CrystalTaggart](https://community.dreamfactory.com/u/CrystalTaggart)\
**Post date:** [July 29, 2019, 3:49pm UTC](https://community.dreamfactory.com/t/queued-scripting-working-inconsistently/4996/1 "2019-07-29T15:49:26Z")

</div>

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:  
[https://blog.dreamfactory.com/queueing-with-dreamfactory-scripting/](https://blog.dreamfactory.com/queueing-with-dreamfactory-scripting/)  
[https://wiki.dreamfactory.com/DreamFactory/Features/Scripting#Queued\_Scripting\_Setup](https://wiki.dreamfactory.com/DreamFactory/Features/Scripting#Queued_Scripting_Setup)  
[https://wiki.dreamfactory.com/DreamFactory/Features/Scripting/Script\_Services](https://wiki.dreamfactory.com/DreamFactory/Features/Scripting/Script_Services)

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”
