Closed (fixed)
Project:
Ooyala
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Aug 2012 at 22:28 UTC
Updated:
1 Feb 2013 at 02:20 UTC
Jump to comment: Most recent file
Everytime this hook_cron function kicks off, it appears to be returning 500 rows of data from the api which is taking upwards of 20 sec to execute. Is the $last_sync variable supposed to help limit that in anyway? It appears to be read and updated, but I don't see where in the code or api query it's used.
242 // Running the sync can take a long time. Only process videos since last sync.
243 $sync_time = REQUEST_TIME;
244 $last_sync = variable_get('ooyala_last_sync', 0);
245
246 // Pull from Ooyala all videos that have been updated since last run.
247 $videos = ooyala_api_video_query(array('orderBy' => 'updatedAt,asc', 'fields' => 'labels'));
248 ooyala_sync_pull_videos($videos);
249
250 // Set the sync time so that we don't need to process unchanged videos.
251 variable_set('ooyala_last_sync', $sync_time);Thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | ooyala_cron_latest.patch | 753 bytes | quicksketch |
Comments
Comment #1
torgospizza500 items is the default max number of items returned by the Ooyala API. I think the best solution here would be to pass that in as an argument (and let it be configurable by an admin).
Comment #2
mlee11111 commentedThanks for the quick reply.
Should ooyala_api_video_query() somehow use $last_sync to also limit items back?
Comment #3
torgospizzaYeah, it seems like $last_sync should be added to the video query in some way, so that it only pulls videos that have been updated since that last timestamp. After looking at the Ooyala API docs the resulting URL will need to be something like this (for V2):
[GET] /v2/assets?where=time_restrictions.start_date<='2011-06-01T00:00:00Z'+AND+time_restrictions.end_date>='2011-06-01T01:00:00Z'
More examples: http://support.ooyala.com/developers/documentation/reference/query.html
Comment #4
quicksketchThis is silly. Looks like it must have been broken in the upgrade from the v1 API. If we don't have the WHERE clause in there then we could end up never processing new videos because we'll never get past the first 500 videos.
This patch corrects the problem, applied to the 2.x branches of both D6 and D7. I'll be making new recommended releases.