Skip to content

Commit 470e22f

Browse files
authored
fix: reduce unnecessary rest calls (#1452)
1 parent 0f78dd6 commit 470e22f

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

client/src/connection/rest/index.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,11 @@ class RestSession extends Session {
142142
if (!this._computeSession?.sessionId) {
143143
throw new Error();
144144
}
145-
146145
//Get the job
147146
const job = await this._computeSession.execute({ code: [code] });
148-
let state = await job.getState();
149-
150-
const retLog = this.printJobLog(job);
151-
152-
//Wait until the job is complete
153-
do {
154-
state = await job.getState({ onChange: true, wait: 2 });
155-
} while (await job.isDone(state));
156147

157148
//Clear out the logs
158-
await retLog;
159-
149+
await this.printJobLog(job);
160150
//Now get the results
161151
const results = await job.results();
162152

@@ -290,7 +280,7 @@ class RestSession extends Session {
290280
* @param job a job id to print logs for.
291281
*/
292282
private printJobLog = async (job: ComputeJob) => {
293-
const logs = await job.getLogStream();
283+
const logs = job.getLogStream();
294284
for await (const log of logs) {
295285
if (log?.length > 0) {
296286
this._onExecutionLogFn(log);

0 commit comments

Comments
 (0)