Skip to content

Commit

Permalink
Merge pull request #226 from Pldi23/flakebusters_activity_restart
Browse files Browse the repository at this point in the history
Call ResetTimer synchronously from eol and skip the Tick when channel is null
  • Loading branch information
jglick committed Aug 11, 2022
2 parents d11361f + ebc33aa commit 43d80fe
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -336,11 +336,13 @@ private Object readResolve() {
@Override
public OutputStream decorateLogger(@SuppressWarnings("rawtypes") Run build, final OutputStream logger)
throws IOException, InterruptedException {
// TODO if channel == null, we can safely ResetTimer.call synchronously from eol and skip the Tick
AtomicBoolean active = new AtomicBoolean();
OutputStream decorated = new LineTransformationOutputStream() {
@Override
protected void eol(byte[] b, int len) throws IOException {
if (channel == null) {
new ResetTimer(id).call();
}
logger.write(b, 0, len);
active.set(true);
}
Expand All @@ -357,7 +359,9 @@ public void close() throws IOException {
logger.close();
}
};
new Tick(active, new WeakReference<>(decorated), timeout, channel, id).schedule();
if (channel != null) {
new Tick(active, new WeakReference<>(decorated), timeout, channel, id).schedule();
}
return decorated;
}
}
Expand Down

0 comments on commit 43d80fe

Please sign in to comment.