cron: permit entry.schedule() to reuse existing
This commit is contained in:
parent
6b347d8a1b
commit
4bcb4bdfb8
|
@ -135,10 +135,13 @@ static size_t lcron_findindex(lua_State *L, cronent_ud_t *ud) {
|
||||||
|
|
||||||
static int lcron_schedule(lua_State *L) {
|
static int lcron_schedule(lua_State *L) {
|
||||||
cronent_ud_t *ud = luaL_checkudata(L, 1, "cron.entry");
|
cronent_ud_t *ud = luaL_checkudata(L, 1, "cron.entry");
|
||||||
char *strdesc = (char*)luaL_checkstring(L, 2);
|
char *strdesc = (char*)luaL_optstring(L, 2, NULL);
|
||||||
|
|
||||||
|
if (strdesc != NULL) {
|
||||||
struct cronent_desc desc;
|
struct cronent_desc desc;
|
||||||
lcron_parsedesc(L, strdesc, &desc);
|
lcron_parsedesc(L, strdesc, &desc);
|
||||||
ud->desc = desc;
|
ud->desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
size_t i = lcron_findindex(L, ud);
|
size_t i = lcron_findindex(L, ud);
|
||||||
|
|
||||||
|
|
|
@ -83,10 +83,10 @@ end)
|
||||||
|
|
||||||
## cron.entry:schedule()
|
## cron.entry:schedule()
|
||||||
|
|
||||||
Sets a new schedule mask.
|
Sets a new schedule mask and/or restores an unscheduled entry.
|
||||||
|
|
||||||
#### Syntax
|
#### Syntax
|
||||||
`schedule(mask)`
|
`schedule([mask])`
|
||||||
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
- `mask` - [crontab](https://en.wikipedia.org/wiki/Cron#Overview)-like string mask for schedule
|
- `mask` - [crontab](https://en.wikipedia.org/wiki/Cron#Overview)-like string mask for schedule
|
||||||
|
|
Loading…
Reference in New Issue