Skip to content

Commit

Permalink
Add more debug log statements
Browse files Browse the repository at this point in the history
  • Loading branch information
aliok committed Jan 24, 2024
1 parent 9068f70 commit 3e934f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/graphql/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export abstract class Task<R extends TaskResult, S extends TaskSpec> extends Bas
});

try {
return await graphqlWithSignal(
return graphqlWithSignal(
this.getGraphqlQuery(context),
this.buildQueryParameters(context)
);
Expand Down
14 changes: 13 additions & 1 deletion src/queue/taskqueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ export abstract class BaseTask<ResultType, TaskSpec, Context> implements Task<Re
return this
.execute(context, options.signal)
.then((result) => {
if(!result){
logger.debug(`Task ${this.getId(context)} execution produced null result.`);
}
return {
task: this,
output: result,
Expand Down Expand Up @@ -278,6 +281,12 @@ export class TaskQueue<ResultType, TaskSpec, Context> {
logger.debug(`Backing queue state: ${JSON.stringify(this.getState())}`);
const taskResult = await this.backingQueue.add(task.createExecutable(this.context), {signal: this.abortController.signal}) as TaskResult<ResultType, TaskSpec, Context>;
logger.debug(`Task ${task.getId(this.context)} done`);
if(!taskResult){
logger.debug(`Task ${task.getId(this.context)} returned null result.`);
}
if(!taskResult.output){
logger.debug(`Task ${task.getId(this.context)} returned null output.`);
}
output = taskResult.output;
} catch (e) {
try {
Expand Down Expand Up @@ -361,7 +370,10 @@ export class TaskQueue<ResultType, TaskSpec, Context> {
}
}

if (output) {
if(!output){
logger.debug(`Task ${task.getId(this.context)} returned null output, not processing it.`);
}
else {
logger.debug(`Task ${task.getId(this.context)} returned output, processing it.`);
try {
// we got the output. it can be the result of a task that completed successfully, or a task that errored
Expand Down

0 comments on commit 3e934f4

Please sign in to comment.