Skip to content

Commit

Permalink
fix: ready and config change events triggering (#653)
Browse files Browse the repository at this point in the history
Signed-off-by: liran2000 <[email protected]>
  • Loading branch information
liran2000 authored Feb 2, 2024
1 parent 4673304 commit 677e07a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,19 @@ public void initialize(EvaluationContext evaluationContext) throws Exception {
state = ProviderState.READY;
log.info("finished initializing provider, state: {}", state);

configCatClient.getHooks().addOnClientReady(() -> {
ProviderEventDetails providerEventDetails = ProviderEventDetails.builder()
.message("provider ready")
.build();
emitProviderReady(providerEventDetails);
});

configCatClient.getHooks().addOnConfigChanged(map -> {
ProviderEventDetails providerEventDetails = ProviderEventDetails.builder()
.flagsChanged(new ArrayList<>(map.keySet()))
.message("config changed")
.build();
emitProviderReady(providerEventDetails);
emitProviderConfigurationChanged(providerEventDetails);
});

configCatClient.getHooks().addOnError(errorMessage -> {
Expand Down

0 comments on commit 677e07a

Please sign in to comment.