Skip to content

Instantly share code, notes, and snippets.

@lamp
Created February 15, 2010 14:31
Show Gist options
  • Save lamp/304682 to your computer and use it in GitHub Desktop.
Save lamp/304682 to your computer and use it in GitHub Desktop.
Schedule
- UUID
- presentation_id
- interrupted
- interruption_id
- current_core_event_uuid
ScheduleEvent - this is all about assigning a UUID to each change of state
- schedule_id (note ~ 10 events per schedule is the scaling norm)
- UUID
- created_at
- starts_at (nil for ScheduleInterruption)
- document_layout (needed to support VAST stuff)
- document_content
ScheduleInterruption
- schedule_id
- description
- document_layout (needed to support VAST stuff)
- document_content
ScheduleSource - supports the emergency switching of sources (allows ur admin 2 pre-populate da dataz)
- schedule_id
- rank (sort order)
- description
- url (assumed to be RTMP for now - should check format on this basis)
- tag
Installation
Other stack changes
------------------------------
<iframe />-based embed code for events (for now, until player v4 and the Coming of the Comet)
FUTURE: optional SEs (would need to wrap up optional UUID + last known compulsory UUID to ensure consistent state) - no concrete use case as yet
FUTURE: key-value store with expiry to replace lookup of Schedule.{current_uuid}
FUTURE: due-dilligence with regard to timezones - for now need to ensure DB is in correct TZ
Deployment:
- DB server with schema above
- each app server runs a cronjob to update the set of statically compiled schedule_UUID.js files for use by nginx - NOTE: limitation of ~30s lead time on any SE (including interruptions) - make business aware
- admin app (also available from any app server) allows for schedule event creation and interrupt creation
-- presents the timeline of scheduled content
-- presents a pool of interruptions
-- adding an interruption creates a ScheduleInterruption
-- hitting the 'use now' button for an interruption (or whatever) creates a ScheduleEvent with a nil starts_at _and_ populates schedule.interruption_id
-- removing the interruption sets the schedule.interruption_id to nil
Cronjob - the first - all app servers
- for each schedule
- current event = schedule.interrupted? ? ScheduleEvent.last (:starts_at => nil) : ScheduleEvent.first(:starts_at.gte => 'NOW()', :order => [:starts_at])
-- double-check that above query does will not return anything with starts_at == NULL
Cronjob - the second - batch server
- for each schedule
-- update the relevant presentation on core
-- update the schedule.current_core_event_uuid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment