Skip to content

Commit

Permalink
modules/kvs: Consolidate identical calls
Browse files Browse the repository at this point in the history
Consolidate multiple calls to flux_event_subscribe(), that go through
the same error path, into a single if statement.
  • Loading branch information
chu11 committed Feb 26, 2020
1 parent e2890e8 commit 6731200
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/modules/kvs/kvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,9 @@ static int event_subscribe (kvs_ctx_t *ctx, const char *ns)
/* These belong to all namespaces, subscribe once the first
* time we init a namespace */

if (flux_event_subscribe (ctx->h, "hb") < 0) {
flux_log_error (ctx->h, "flux_event_subscribe");
goto cleanup;
}

if (flux_event_subscribe (ctx->h, "kvs.stats.clear") < 0) {
flux_log_error (ctx->h, "flux_event_subscribe");
goto cleanup;
}

if (flux_event_subscribe (ctx->h, "kvs.dropcache") < 0) {
if (flux_event_subscribe (ctx->h, "hb") < 0
|| flux_event_subscribe (ctx->h, "kvs.stats.clear") < 0
|| flux_event_subscribe (ctx->h, "kvs.dropcache") < 0) {
flux_log_error (ctx->h, "flux_event_subscribe");
goto cleanup;
}
Expand Down

0 comments on commit 6731200

Please sign in to comment.