diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index be1a754a..8e57885d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -78,6 +78,8 @@ jobs: with: gcov: true fail_ci_if_error: true + gcov_include: include plugins src + gcov_ignore: tests simulator ft: runs-on: ubuntu-20.04 @@ -116,6 +118,8 @@ jobs: uses: codecov/codecov-action@v3 with: gcov: true + gcov_include: include plugins src + gcov_ignore: tests simulator pyft: runs-on: ubuntu-20.04 @@ -170,4 +174,6 @@ jobs: uses: codecov/codecov-action@v3 with: gcov: true + gcov_include: include plugins src + gcov_ignore: tests simulator diff --git a/dev.conf b/dev.conf index 60c49169..1980588e 100644 --- a/dev.conf +++ b/dev.conf @@ -4,8 +4,8 @@ file perms = 666 [formats] -stdout_format = "%d [%V] [%c] %f:%L %m%n" -file_format = "%d [%V] %f:%L %m%n" +stdout_format = "%d:%ms [%V] [%c] %f:%L %m%n" +file_format = "%d:%ms [%V] %f:%L %m%n" [rules] diff --git a/plugins/restful/rw_handle.c b/plugins/restful/rw_handle.c index e4887949..ea686dbf 100644 --- a/plugins/restful/rw_handle.c +++ b/plugins/restful/rw_handle.c @@ -79,6 +79,10 @@ void handle_write(nng_aio *aio) return; } + nng_http_req *nng_req = nng_aio_get_input(aio, 0); + nlog_notice("<%p> req %s %s", aio, nng_http_req_get_method(nng_req), + nng_http_req_get_uri(nng_req)); + header.ctx = aio; header.type = NEU_REQ_WRITE_TAG; @@ -144,6 +148,9 @@ void handle_write_tags(nng_aio *aio) } } + nng_http_req *nng_req = nng_aio_get_input(aio, 0); + nlog_notice("<%p> req %s %s", aio, nng_http_req_get_method(nng_req), + nng_http_req_get_uri(nng_req)); header.ctx = aio; header.type = NEU_REQ_WRITE_TAGS; diff --git a/src/adapter/driver/driver.c b/src/adapter/driver/driver.c index 7abe1cd9..65959692 100644 --- a/src/adapter/driver/driver.c +++ b/src/adapter/driver/driver.c @@ -104,6 +104,8 @@ static void write_response(neu_adapter_t *adapter, void *r, neu_error error) req->type = NEU_RESP_ERROR; + nlog_notice("write tag response <%p>", req->ctx); + adapter->cb_funs.response(adapter, req, &nerror); free(req); } @@ -311,12 +313,20 @@ void neu_adapter_driver_start_group_timer(neu_adapter_driver_t *driver) .type = NEU_EVENT_TIMER_NOBLOCK, }; - param.cb = report_callback; - el->report = neu_adapter_add_timer((neu_adapter_t *) driver, param); - param.type = driver->adapter.module->timer_type; param.cb = read_callback; el->read = neu_event_add_timer(driver->driver_events, param); + + struct timespec t1 = { + .tv_sec = 0, + .tv_nsec = 1000 * 1000 * 20, + }; + struct timespec t2 = { 0 }; + nanosleep(&t1, &t2); + + param.type = NEU_EVENT_TIMER_NOBLOCK; + param.cb = report_callback; + el->report = neu_adapter_add_timer((neu_adapter_t *) driver, param); } } @@ -700,14 +710,23 @@ int neu_adapter_driver_add_group(neu_adapter_driver_t *driver, const char *name, neu_group_split_static_tags(find->group, &find->static_tags, &find->grp.tags); + param.type = driver->adapter.module->timer_type; + param.cb = read_callback; + find->read = neu_event_add_timer(driver->driver_events, param); + + struct timespec t1 = { + .tv_sec = 0, + .tv_nsec = 1000 * 1000 * 20, + }; + struct timespec t2 = { 0 }; + nanosleep(&t1, &t2); + + param.type = NEU_EVENT_TIMER_NOBLOCK; param.cb = report_callback; find->report = neu_adapter_add_timer((neu_adapter_t *) driver, param); - param.type = driver->adapter.module->timer_type; - param.cb = read_callback; - find->read = neu_event_add_timer(driver->driver_events, param); param.second = 0; - param.millisecond = 100; + param.millisecond = 3; param.cb = write_callback; find->write = neu_event_add_timer(driver->driver_events, param); @@ -796,11 +815,21 @@ int neu_adapter_driver_update_group(neu_adapter_driver_t *driver, neu_group_set_interval(find->group, interval); // restore the timers + + param.type = driver->adapter.module->timer_type; + param.cb = read_callback; + find->read = neu_event_add_timer(driver->driver_events, param); + + struct timespec t1 = { + .tv_sec = 0, + .tv_nsec = 1000 * 1000 * 20, + }; + struct timespec t2 = { 0 }; + nanosleep(&t1, &t2); + + param.type = NEU_EVENT_TIMER_NOBLOCK; param.cb = report_callback; find->report = neu_adapter_add_timer((neu_adapter_t *) driver, param); - param.type = driver->adapter.module->timer_type; - param.cb = read_callback; - find->read = neu_event_add_timer(driver->driver_events, param); return ret; } diff --git a/src/utils/http.c b/src/utils/http.c index fb326465..af097bbc 100644 --- a/src/utils/http.c +++ b/src/utils/http.c @@ -51,7 +51,7 @@ static int response(nng_aio *aio, char *content, enum nng_http_status status) nng_http_res_set_status(res, status); nng_http_req *nng_req = nng_aio_get_input(aio, 0); - nlog_notice("%s %s [%d]", nng_http_req_get_method(nng_req), + nlog_notice("<%p> %s %s [%d]", aio, nng_http_req_get_method(nng_req), nng_http_req_get_uri(nng_req), status); nng_aio_set_output(aio, 0, res); diff --git a/zlog.conf b/zlog.conf index f2b157ce..2f2e8cbf 100644 --- a/zlog.conf +++ b/zlog.conf @@ -4,7 +4,7 @@ file perms = 666 [formats] -simple = "%d [%V] %f:%L %m%n" +simple = "%d:%ms [%V] %f:%L %m%n" [rules]