Skip to content

Commit

Permalink
Cleanup JSON response from fetchers
Browse files Browse the repository at this point in the history
  • Loading branch information
sopel39 authored and wendigo committed Dec 5, 2023
1 parent d466971 commit 7a7ac6c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ public void success(TaskStatus value)
errorTracker.requestSucceeded();
}
finally {
cleanupRequest();
scheduleNextRequest();
}
}
Expand All @@ -203,6 +204,7 @@ public void failed(Throwable cause)
onFail.accept(e);
}
finally {
cleanupRequest();
scheduleNextRequest();
}
}
Expand All @@ -218,6 +220,14 @@ public void fatal(Throwable cause)
}
}

private synchronized void cleanupRequest()
{
if (future != null && future.isDone()) {
// remove outstanding reference to JSON response
future = null;
}
}

void updateTaskStatus(TaskStatus newValue)
{
// change to new value if old value is not changed and new value has a newer version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public void success(VersionedDynamicFilterDomains newDynamicFilterDomains)
errorTracker.requestSucceeded();
}
finally {
cleanupRequest();
fetchDynamicFiltersIfNecessary();
}
}
Expand All @@ -190,6 +191,7 @@ public void failed(Throwable cause)
onFail.accept(e);
}
finally {
cleanupRequest();
fetchDynamicFiltersIfNecessary();
}
}
Expand All @@ -205,6 +207,14 @@ public void fatal(Throwable cause)
}
}

private synchronized void cleanupRequest()
{
if (future != null && future.isDone()) {
// remove outstanding reference to JSON response
future = null;
}
}

private void updateDynamicFilterDomains(VersionedDynamicFilterDomains newDynamicFilterDomains)
{
synchronized (this) {
Expand Down

0 comments on commit 7a7ac6c

Please sign in to comment.