Skip to content

A Deadly Efficient Tasking System for Golang

License

Notifications You must be signed in to change notification settings

clouedoc/goschedule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

goschedule

~ A Deadly Efficient Tasking System for Golang ~

Features

  • safe for concurent use
    • use it accross goroutines !
  • precise to the minute
  • lightweight
    • efficient memory management
  • intuitive API
  • easy task management
    • add tasks
    • remove tasks

Installation

go get github.com/jesuiscamille/goschedule

To use it in your project, add this:

import "github.com/jesuiscamille/goschedule"

Example

package main

import (
    "fmt"
    "time"
    "github.com/jesuiscamille/goschedule"
)

func main() {
    // This creates a scheduler.
    scheduler := goschedule.NewScheduler()

    // Adding a task will automagically start the scheduler
    id := scheduler.AddTask(15, 30, func() {
        now := time.Now()
        fmt.Printf("Hello, it's %d:%d !\n", now.Hour(), now.Minute())
    })

    _ = id

    for {
        time.Sleep(time.Hour)
    }
}

If you change your mind, you can remove a task:

// If no task remains, the scheduler will automagically
// be stopped.
// Note: id is obtained as a result of scheduler.AddTask(...)
_ = scheduler.RemoveTask(id)

LICENSE

This code is licensed under the GNU GPLv3. grosso-modo, you can do whatever you want with the code albeit using it in closed source commercial projects without sharing back your modifications. Please see LICENSE for more details.

TODO

  • Documentation
  • Custom Arguments
  • Precision
  • Cool logo
  • Being cool

I usually remove items I'm working on from the list, so feel free to make your changes and open a pull request !

About

A Deadly Efficient Tasking System for Golang

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages