<p>I use this to force the task icon to show up immediately:</p>

<pre><code>Craft.cp.setRunningTaskInfo({
    "id": "task ID",
    "level": "0",
    "description": "description",
    "status": "running",
    "progress": 0
});
Craft.cp.trackTaskProgress();
</code></pre>

CC BY-SA 3.0
2015-06-21T14:40:02.177Z
2015-06-21T14:40:02.177Z
Bob Olde Hampsink
<p>I have a plugin that starts a task and subtasks from a CP widget AJAX call. The tasks are running without a hitch, but for some reason on production, the icon does not appear when the tasks start running unless I refresh the page. </p>

<p>On my local dev site (MAMP), the task icon appears as soon as the code below is called.</p>

<p>I am using this code to start the pending tasks I created:</p>

<pre><code>Craft.cp.runPendingTasks();
</code></pre>

<p>Any ideas? Is there a different JS command I should be using?</p>

CC BY-SA 3.0
2015-03-11T22:17:36.507Z
I've seen that on some setups with gzip compression enabled (either at the Apache level or at the PHP level). Might be worth checking.
Brad Bell
CC BY-SA 3.0
2015-03-12T20:53:12.710Z
Yup, it looks like that is the case. Any thoughts on getting around it? It isn't imperative that the circle displays, but the visual feedback is nice.
Aaron Berkowitz
CC BY-SA 3.0
2015-03-12T20:55:53.120Z
We've spent a ton of time looking into it and it comes down to the fact that PHP sucks. Workaround is to set http://buildwithcraft.com/docs/config-settings#runTasksAutomatically to false and setup an external cron job to trigger tasks.
Brad Bell
<plugin-development><control-panel><javascript><tasks>
Trigger Task Status Icon
# Trigger Task Status Icon

(Asked by: username_0 on 2015-03-11)

I have a plugin that starts a task and subtasks from a CP widget AJAX call. The tasks are running without a hitch, but for some reason on production, the icon does not appear when the tasks start running unless I refresh the page. 
On my local dev site (MAMP), the task icon appears as soon as the code below is called.
I am using this code to start the pending tasks I created:
Craft.cp.runPendingTasks();

Any ideas? Is there a different JS command I should be using?

**Tags:** plugin-development, control-panel, javascript, tasks
> **Comments:**
> **username_1**: I've seen that on some setups with gzip compression enabled (either at the Apache level or at the PHP level). Might be worth checking.  
> **username_0**: Yup, it looks like that is the case. Any thoughts on getting around it? It isn't imperative that the circle displays, but the visual feedback is nice.  
> **username_1**: We've spent a ton of time looking into it and it comes down to the fact that PHP sucks. Workaround is to set http://buildwithcraft.com/docs/config-settings#runTasksAutomatically to false and setup an external cron job to trigger tasks.  

---

## 1 answers

### Answer by username_2 on 2015-06-21. Score: 6

I use this to force the task icon to show up immediately:
Craft.cp.setRunningTaskInfo({
    "id": "task ID",
    "level": "0",
    "description": "description",
    "status": "running",
    "progress": 0
});
Craft.cp.trackTaskProgress();


---

