chore: Fix Installation complete event not being sent (#20301)

The problem was that the Mono returned by `analyticsService.sendEvent`
was returned inside a `.map` call, which, (almost) always results in a
bug.

This PR fixes that.
This commit is contained in:
Shrikant Sharat Kandula 2023-02-02 12:09:01 +05:30 committed by PiyushPushkar02
parent 9e3867c50f
commit 0845f783d0
2 changed files with 4 additions and 2 deletions

View File

@ -21,6 +21,8 @@ public class ExchangeUtils {
contextView.get(ServerWebExchange.class).getRequest().getHeaders().getFirst(HEADER_ANONYMOUS_USER_ID),
FieldName.ANONYMOUS_USER
))
// An error is thrown when the context is not available. We don't want to fail the request in this case.
.onErrorResume(error -> Mono.empty())
.defaultIfEmpty(FieldName.ANONYMOUS_USER);
}

View File

@ -225,7 +225,7 @@ public class UserSignupCEImpl implements UserSignupCE {
return Mono.when(
userDataService.updateForUser(user, userData),
configService.getInstanceId()
.map(instanceId -> {
.flatMap(instanceId -> {
log.debug("Installation setup complete.");
analyticsService.identifyInstance(instanceId, userData.getRole(), userData.getUseCase());
return analyticsService.sendEvent(
@ -239,7 +239,7 @@ public class UserSignupCEImpl implements UserSignupCE {
"goal", ObjectUtils.defaultIfNull(userData.getUseCase(), "")
),
false
).thenReturn(instanceId);
);
}),
envManager.applyChanges(Map.of(
APPSMITH_DISABLE_TELEMETRY.name(),