Skip to content

Commit bca27b2

Browse files
committed
Cleanup using finally chain
1 parent 0b84a32 commit bca27b2

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/resource_clients/actor.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,13 @@ export class ActorClient extends ResourceClient {
155155
const newRunClient = this.apifyClient.run(id);
156156

157157
const streamedLog = await newRunClient.getStreamedLog({ toLog: options?.log });
158-
let actorRun: Promise<ActorRun> | undefined;
159-
try {
160-
streamedLog?.start();
161-
actorRun = this.apifyClient.run(id).waitForFinish({ waitSecs });
162-
return actorRun;
163-
} finally {
164-
await actorRun;
165-
await streamedLog?.stop();
166-
}
158+
streamedLog?.start();
159+
return this.apifyClient
160+
.run(id)
161+
.waitForFinish({ waitSecs })
162+
.finally(async () => {
163+
await streamedLog?.stop();
164+
});
167165
}
168166

169167
/**

0 commit comments

Comments
 (0)