Hi @anon89371750 ,
For better performances, i don’t want to call api.video each time i load a video thumbnail in my front application (in a video list for example), so i store the “lastAt” int in my db.
I want to update the “lastAt” property i stored in my db, for each video and user couple.
I want to execute, every x minutes, this process (via a cron) :
- step 1 : in my db, get all media (“video” type), viewed last hour, and not present in my video_user_sessions table (api_video_id / user_id / api_video_session_id / loaded_at / ended_at)
- step 2 : with this list of media containing a api_video_id, i call api.video to get all analytic sessions for each video (api_video_id)
- step 3 : i insert in my db, if not exist, each session data in my video_user_sessions table
- step 4 : in my db, get all sessions not ended (video_user_sessions table)
- step 5 : for each api_video_session_id, i call api.video to get all session events and found the last “at” for update the lastAt field (for couple apiVideoId/userId) in my db
- step 6 : delete sessions in my video_user_sessions table where endedAt < now
What do think about this process ? A better idea ?
Thanks.
Gaëtan.