Skip to content

Commit

Permalink
Run ci weekly (#38)
Browse files Browse the repository at this point in the history
Configure CI to run weekly
Simplify finalizeConfig() by letting the caller makes the state update of the parser.
  • Loading branch information
moticless authored Jan 4, 2024
1 parent df07dbc commit 26d0c48
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions src/lib/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
{
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 26d0c48

Please sign in to comment.