Skip to content

Commit

Permalink
puts search finalizer in job
Browse files Browse the repository at this point in the history
Signed-off-by: Max Thonagel <[email protected]>
  • Loading branch information
thoniTUB committed Apr 8, 2024
1 parent 78de795 commit 2eb9ec6
Showing 1 changed file with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.bakdata.conquery.models.datasets.Table;
import com.bakdata.conquery.models.events.Bucket;
import com.bakdata.conquery.models.events.stores.root.StringStore;
import com.bakdata.conquery.models.jobs.SimpleJob;
import com.bakdata.conquery.models.jobs.UpdateFilterSearchJob;
import com.bakdata.conquery.models.messages.namespaces.ActionReactionMessage;
import com.bakdata.conquery.models.messages.namespaces.NamespacedMessage;
Expand Down Expand Up @@ -94,20 +95,29 @@ public void react(Worker context) throws Exception {
log.debug("Still waiting for jobs: {} of {} done", done.get(), futures.size());
}
}

log.info("Finished collecting values from these columns: {}", Arrays.toString(columns.toArray()));
context.send(new FinalizeReactionMessage(getMessageId(), context.getInfo().getId()));
}

@Override
public void afterAllReaction() {
log.debug("{} shrinking searches", this);
final FilterSearch filterSearch = namespace.getFilterSearch();
columns.forEach(filterSearch::shrinkSearch);


log.info("BEGIN counting Search totals.");
UpdateFilterSearchJob.getAllSelectFilters(namespace.getStorage()).forEach(namespace.getFilterSearch()::getTotal);
log.debug("FINISHED counting Search totals.");
// Run this in a job, so it is definitely processed after UpdateFilterSearchJob
namespace.getJobManager().addSlowJob(
new SimpleJob(
"Finalize Search update",
() -> {
log.debug("{} shrinking searches", this);
final FilterSearch filterSearch = namespace.getFilterSearch();
columns.forEach(filterSearch::shrinkSearch);


log.info("BEGIN counting Search totals.");
UpdateFilterSearchJob.getAllSelectFilters(namespace.getStorage()).forEach(namespace.getFilterSearch()::getTotal);
log.debug("FINISHED counting Search totals.");
}
)
);
}
}

0 comments on commit 2eb9ec6

Please sign in to comment.