-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added cron.jl module for parsing cron expressions - Added support for week and month abbreviations and single values in cron expressions - Fixed bugs related to single-value expressions and added support for partial patterns and special patterns in cron expressions - Integrated cron module with router function and added cron job example - Added logging to repeat tasks and cron jobs, and improved logging formats - Refactored variable names, fixed bugs in cron scheduling logic, and added default mimetype value for missing values - Added exports for cron helpers, updated cron tests, and made serve functions return server object if run in async mode - Added more cron test cases and documentation for cron scheduling feature - Bumped version to v1.1.6
- Loading branch information
Showing
14 changed files
with
1,403 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "Oxygen" | ||
uuid = "df9a0d86-3283-4920-82dc-4555fc0d1d8b" | ||
authors = ["Nathan Ortega <[email protected]>"] | ||
version = "1.1.5" | ||
version = "1.1.6" | ||
|
||
[deps] | ||
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
module CronDemo | ||
|
||
include("../src/Oxygen.jl") | ||
using .Oxygen | ||
using HTTP | ||
using Dates | ||
|
||
# You can use the @cron macro directly | ||
|
||
@cron "*/2" function() | ||
println("every 2 seconds") | ||
end | ||
|
||
@cron "*/5" function every5seconds() | ||
println("every 5 seconds") | ||
end | ||
|
||
value = 0 | ||
|
||
# You can also just use the 'cron' keyword that's apart of the router() function | ||
@get router("/increment", cron="*/11", interval=4) function() | ||
global value += 1 | ||
return value | ||
end | ||
|
||
@get router("/getvalue") function() | ||
return value | ||
end | ||
|
||
# all endpoints will inherit this cron expression | ||
pingpong = router("/pingpong", cron="*/3") | ||
|
||
@get pingpong("/ping") function() | ||
println("ping") | ||
return "ping" | ||
end | ||
|
||
# here we override the inherited cron expression | ||
@get pingpong("/pong", cron="*/7") function() | ||
println("pong") | ||
return "pong" | ||
end | ||
|
||
@get "/home" function() | ||
"home" | ||
end | ||
|
||
@get "/stop" function() | ||
stopcronjobs() | ||
end | ||
|
||
@get "/start" function() | ||
startcronjobs() | ||
end | ||
|
||
serve() | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
fa69326
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
fa69326
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/81186
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: