Git Product home page Git Product logo

elixir_dev_interview's Introduction

Firework Interview Assignment

Write tests to assert ExScheduler.Worker periodic behaviour in test/ex_scheduler/worker_test.exs.

ExScheduler

Cron-like job scheduler in few lines of elixir code.
Inspired in this answer by José Valim.
Added cron syntax, with extended support for seconds.

Installation

def deps do
  [
    {:ex_scheduler, "~> 0.1.0"}
  ]
end

Add ExScheduler.Worker to your supervision tree:

  children = [
    {ExScheduler.Worker, jobs}
  ]

And the jobs configuration:

  defp jobs() do
    [
      %{cron: "* * * * * *", module: Example, function: :hello, args: ["world"]},
      %{cron: "* * * * * *", module: PerformExample},
    ]
  end

If using Phoenix Framework, you should pull this configuration from config.exs.

Important:

  • When the function is omitted, perform/0 function is called.
  • When args are ommited, the function is called with no attributes.
  • Cron expressions are evaluated over UTC time.

elixir_dev_interview's People

Contributors

alexandremcosta avatar esparta avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.