mirror of
https://github.com/apache/superset.git
synced 2026-04-26 11:34:27 +00:00
fix(celery): Reset DB connection pools for forked worker processes (#13350)
* Reset sqlalchemy connection pool on celery process fork * Fix race condition with async chart loading state * pylint: ignore * prettier
This commit is contained in:
@@ -119,8 +119,7 @@ const initAsyncEvents = (options: AsyncEventOptions) => {
|
||||
};
|
||||
|
||||
const processEvents = async () => {
|
||||
const state = store.getState();
|
||||
const queuedComponents = getPendingComponents(state);
|
||||
let queuedComponents = getPendingComponents(store.getState());
|
||||
const eventArgs = lastReceivedEventId
|
||||
? { last_id: lastReceivedEventId }
|
||||
: {};
|
||||
@@ -128,6 +127,9 @@ const initAsyncEvents = (options: AsyncEventOptions) => {
|
||||
if (queuedComponents && queuedComponents.length) {
|
||||
try {
|
||||
const { result: events } = await fetchEvents(eventArgs);
|
||||
// refetch queuedComponents due to race condition where results are available
|
||||
// before component state is updated with asyncJobId
|
||||
queuedComponents = getPendingComponents(store.getState());
|
||||
if (events && events.length) {
|
||||
const componentsByJobId = queuedComponents.reduce((acc, item) => {
|
||||
acc[item.asyncJobId] = item;
|
||||
|
||||
Reference in New Issue
Block a user