Upgrade to Pro — share decks privately, control downloads, hide ads and more …

go-bj4 — Background Job Scheduler

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →
Avatar for Yao Wei Yao Wei
January 24, 2017

go-bj4 — Background Job Scheduler

Avatar for Yao Wei

Yao Wei

January 24, 2017

Other Decks in Programming

Transcript

  1. . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Intro Details Demo Thank you go-bj4 — Background Job Scheduler Yao Wei Rayark Inc. [email protected] January 24, 2017
  2. . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Intro Details Demo Thank you Why another job scheduler? • We need a job scheduler for game servers to update content at specific time. • One job at a time to prevent from race condition. • Record job status.
  3. . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Intro Details Demo Thank you Internal Workings • New job input into a buffered channel first. • A goroutine for running background jobs: 1. For each enqueued job, run job if specific time reached. 2. Wait for 1 second while enqueue jobs from buffered channel. 3. Repeat
  4. . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Intro Details Demo Thank you Demo
  5. . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Intro Details Demo Thank you Thank you github.com/rayark/go-bj4 Warning: Lots to improve! We are also looking for Gophers! Send your résumé to: [email protected]