{"id":19906482,"url":"https://github.com/lwl1989/timing","last_synced_at":"2025-05-03T02:30:32.436Z","repository":{"id":57483742,"uuid":"130951550","full_name":"lwl1989/timing","owner":"lwl1989","description":"一个适用于一次性或者需要重复性任务的执行器，可配合常驻服务实现自动执行定时任务(非类linux CronTab)","archived":false,"fork":false,"pushed_at":"2021-03-03T10:08:22.000Z","size":46,"stargazers_count":57,"open_issues_count":1,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T01:59:03.015Z","etag":null,"topics":["crontab","ticket","timer"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lwl1989.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-25T04:41:33.000Z","updated_at":"2024-04-26T15:22:20.000Z","dependencies_parsed_at":"2022-08-28T17:40:53.891Z","dependency_job_id":null,"html_url":"https://github.com/lwl1989/timing","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwl1989%2Ftiming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwl1989%2Ftiming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwl1989%2Ftiming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwl1989%2Ftiming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lwl1989","download_url":"https://codeload.github.com/lwl1989/timing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224347545,"owners_count":17296423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crontab","ticket","timer"],"created_at":"2024-11-12T20:36:40.935Z","updated_at":"2024-11-12T20:36:41.472Z","avatar_url":"https://github.com/lwl1989.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# timing\n\nA one-off timed task.\n\n### Thanks\n\n[robfig/cron](https://github.com/robfig/cron)\n\n### ChangeLog\n\n[2018-05-22]  Add Export\n\n[2018-05-22]  Renamed Tasks to TaskScheduler\n\n[2019-02-23]  Add task interface and can rewrite the logic\n\n\n### Quick Start\n\n```\nscheduler := NewScheduler()\n\nscheduler.Start()\n\nscheduler.AddFunc(time.Now().Unix()+1, func() {\n\tfmt.Println(\"one second after\")\n})\n\nscheduler.AddTask(\u0026Task{\n\tJob:FuncJob(func() {\n    \t\tfmt.Println(\"hello task2\")\n    }),\n    RunTime:time.Now().Unix()+4,\n})\n\n//block it\n```\n\nadd task\n```\n//10 seconds print one\nscheduler.AddFuncSpace(10, func() {\n\tfmt.Println(\"one second after\")\n})\n\n\nscheduler.AddTask(\u0026Task{\n\tJob:FuncJob(func() {\n    \t\tfmt.Println(\"hello task\")\n    }),\n    Spacing:4 //4 seconds send one\n})\n\nscheduler.AddTask(\u0026Task{\n\tJob:FuncJob(func() {\n    \t\tfmt.Println(\"hello task2\")\n    }),\n    Spacing:4 //4 seconds send one\n    Number: 5 //exec 5 num go stop\n})\n\nscheduler.AddTask(\u0026Task{\n\tJob:FuncJob(func() {\n    \t\tfmt.Println(\"hello task3\")\n    }),\n    Spacing:4 //4 seconds send one\n    EndTime: 1999999999   // at 199999999 go stop\n})\n```\n\n### task interface\n\nIf you need rewrite a new task\n\nimplement TaskInterface\n\n```\ntype TaskInterface interface {\n    TaskGetInterface\n    TaskSetInterface\n}\n\ntype TaskSetInterface interface {\n    SetJob(job Job) TaskSetInterface\n    SetRuntime(runtime int64) TaskSetInterface\n    SetUuid(uuid string) TaskSetInterface\n    SetSpacing(spacing int64) TaskSetInterface\n    SetEndTime(endTime int64) TaskSetInterface\n    SetRunNumber(number int) TaskSetInterface\n}\n\ntype TaskGetInterface interface{\n    RunJob()\n    GetJob()  Job\n    GetUuid() string\n    GetRunTime() int64\n    GetSpacing() int64\n    GetEndTime() int64\n    GetRunNumber() int\n}\n```\n\n### next\n\n1. distributed the cron task\n\n\n### Example\n\nOrder expire, change order status =\u003e fail\nTiming of the send message\n\nand more","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwl1989%2Ftiming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flwl1989%2Ftiming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwl1989%2Ftiming/lists"}