Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ public Mono<TriggerResultDTO> trigger(

// If the plugin has overridden and implemented the same, use the plugin result
Mono<TriggerResultDTO> resultFromPluginMono = Mono.zip(
validatedDatasourceStorageMono, pluginMono, pluginExecutorMono)
validatedDatasourceStorageMono, pluginMono, pluginExecutorMono, datasourceMonoCached)
.flatMap(tuple -> {
final DatasourceStorage datasourceStorage = tuple.getT1();
final Plugin plugin = tuple.getT2();
final PluginExecutor pluginExecutor = tuple.getT3();
final Datasource datasource = tuple.getT4();

// TODO: Flags are needed here for google sheets integration to support shared drive behind a flag
// Once thoroughly tested, this flag can be removed
Expand All @@ -118,7 +119,7 @@ public Mono<TriggerResultDTO> trigger(
// Now that we have the context (connection details), execute the action.
// datasource remains unevaluated for datasource of DBAuth Type Authentication,
// However the context comes from evaluated datasource.
.flatMap(resourceContext -> setTenantAndInstanceId(triggerRequestDTO)
.flatMap(resourceContext -> populateTriggerRequestDto(triggerRequestDTO, datasource)
.flatMap(updatedTriggerRequestDTO -> ((PluginExecutor<Object>) pluginExecutor)
.triggerWithFlags(
resourceContext.getConnection(),
Expand Down Expand Up @@ -161,13 +162,15 @@ public Mono<TriggerResultDTO> trigger(
return resultFromPluginMono.switchIfEmpty(defaultResultMono);
}

private Mono<TriggerRequestDTO> setTenantAndInstanceId(TriggerRequestDTO triggerRequestDTO) {
private Mono<TriggerRequestDTO> populateTriggerRequestDto(
TriggerRequestDTO triggerRequestDTO, Datasource datasource) {
return tenantService
.getDefaultTenantId()
.zipWith(configService.getInstanceId())
.map(tuple -> {
triggerRequestDTO.setTenantId(tuple.getT1());
triggerRequestDTO.setInstanceId(tuple.getT2());
triggerRequestDTO.setWorkspaceId(datasource.getWorkspaceId());
return triggerRequestDTO;
});
}
Expand Down