api icon indicating copy to clipboard operation
api copied to clipboard

delay loading info

Open songpol opened this issue 10 years ago • 6 comments

Hi, i implemented wunderlist api with php and everythings work fine. Excepting the response time when loading tasks or list or any action to get data from api it take around 1 minute.Does it properly response time? Any suggestion would be appreciate.

songpol avatar Jan 06 '16 10:01 songpol

Hi @songpol. The response time shouldn't be that high. Can you post an example request you are making?

vsmart avatar Jan 06 '16 18:01 vsmart

HI @vsmart .Thanks for your commented.my code as attached.

EXWunderlist.php.zip

songpol avatar Jan 07 '16 06:01 songpol

Could you post (copy/paste) in this issue only the bit where you make the api call?

vsmart avatar Jan 07 '16 09:01 vsmart

Hi @vsmart here is my code.

getLists(); $date = new DateTime(); $today = $date->format('Y-m-d'); $next7days = date('Y-m-d', strtotime('+7 days')); $tasksOverdue = array(); $tasksToday = array(); $tasksNext7 = array(); $count1 = 0; $count2 = 0; $count3 = 0; ``` foreach($lists as $key => $value){ if($key == 0){ $tasksInbox = $w->getTasks([ 'list_id' => $value["id"], 'completed' => '' ]); } } foreach($lists as $key => $value){ $tasks = $w->getTasks([ 'list_id' => $value["id"], 'completed' => '' ]); foreach($tasks as $key2 => $value2){ $notes = $w->getNotes('task', [ 'task_id' => $value2["id"] ]); if($value2["due_date"] ''){ //---DueDate Tasks $tasksOverdue[$count1] = array("id" => $value2["id"], "title" => $value2["title"], "due_date" => $value2["due_date"], "note_content" => $notes[0]["content"], "note_id" => $notes[0]["id"]); $count1 += 1; }else if($value2["due_date"] == $today) { //---Today Tasks $tasksToday[$count2] = array("id" => $value2["id"], "title" => $value2["title"], "due_date" => $value2["due_date"], "note_content" => $notes[0]["content"], "note_id" => $notes[0]["id"]); $count2 += 1; }else if($value2["due_date"] > $today && $value2["due_date"] $value2["id"], "title" => $value2["title"], "due_date" => $value2["due_date"], "note_content" => $notes[0]["content"], "note_id" => $notes[0]["id"]); $count3 += 1; } } } ``` ?>
<div class="row">
    <p>Inbox:<?php echo count($tasksInbox); ?></p>
    <p>Over Due:<?php echo count($tasksOverdue);?></p>
    <p>Today:<?php echo count($tasksToday);?></p>
    <p>Next 7 Days:<?php echo count($tasksNext7);?></p>
</div>

songpol avatar Jan 08 '16 02:01 songpol

Hi @songpol, I suggest that instead of fetching notes for each task, you'll fetch the notes for each list. This will reduce the number of HTTP calls and should make things run faster. For more information, refer to the notes documentation page.

rotev avatar Jan 12 '16 09:01 rotev

Hi @rotev, Thanks for your commented.I will try it according your suggestion.

songpol avatar Jan 12 '16 12:01 songpol