From 26d0c4821b9aa19368a6c0bbac92bdfe3ef18899 Mon Sep 17 00:00:00 2001 From: Moti Cohen Date: Thu, 4 Jan 2024 11:06:59 +0200 Subject: [PATCH] Run ci weekly (#38) Configure CI to run weekly Simplify finalizeConfig() by letting the caller makes the state update of the parser. --- .github/workflows/ci.yml | 3 ++- src/lib/parser.c | 9 ++++++--- src/lib/parser.h | 3 +-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 156c769..d927559 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,11 +3,12 @@ name: CI on: push: pull_request: + schedule: + - cron: '0 0 * * 0' # Run every Sunday at midnight UTC jobs: build: runs-on: ubuntu-latest - steps: - name: Checkout uses: actions/checkout@v3 diff --git a/src/lib/parser.c b/src/lib/parser.c index 76d6210..1fd7bc7 100644 --- a/src/lib/parser.c +++ b/src/lib/parser.c @@ -276,8 +276,10 @@ _LIBRDB_API void RDB_deleteParser(RdbParser *p) { } _LIBRDB_API RdbStatus RDB_parse(RdbParser *p) { - if (p->state == RDB_STATE_CONFIGURING) + if (p->state == RDB_STATE_CONFIGURING) { IF_NOT_OK_RETURN(finalizeConfig(p, 0)); + p->state = RDB_STATE_RUNNING; + } /* nothing special to do after pause */ if (p->state == RDB_STATE_PAUSED) @@ -288,8 +290,10 @@ _LIBRDB_API RdbStatus RDB_parse(RdbParser *p) { _LIBRDB_API RdbStatus RDB_parseBuff(RdbParser *p, unsigned char *buff, size_t size, int isEOF) { - if (p->state == RDB_STATE_CONFIGURING) + if (p->state == RDB_STATE_CONFIGURING) { IF_NOT_OK_RETURN(finalizeConfig(p, 1)); + p->state = RDB_STATE_RUNNING; + } if (p->state != RDB_STATE_PAUSED) { @@ -796,7 +800,6 @@ static RdbStatus finalizeConfig(RdbParser *p, int isParseFromBuff) { resolveMultipleLevelsRegistration(p); - p->state = RDB_STATE_RUNNING; RDB_log(p, RDB_LOG_INF, "Start processing RDB source"); return RDB_STATUS_OK; } diff --git a/src/lib/parser.h b/src/lib/parser.h index a2a2bbf..ceea3a5 100644 --- a/src/lib/parser.h +++ b/src/lib/parser.h @@ -289,8 +289,7 @@ typedef struct ElementCtx { /* The parser can handle one level of nested parsing-elements (PE), whereby a PE * may be called by another PE and control is returned to the caller once the * parsing of sub-element is complete. Currently, this functionality is only - * utilized by the raw list PE, which calls upon the raw string PE to parse - * individual string elements. */ + * utilized to call raw string PE to parse individual string elements. */ typedef struct ParsingSubElement { /* let callee knows which element and state to callback once done */