Skip to content

Commit

Permalink
👌 IMPROVE: Reduce warning log (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored Oct 6, 2022
1 parent 8b5ece2 commit a217fd0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions app/common/adapter/binary/GithubBinary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ export class GithubBinary extends AbstractBinary {
const url = `https://api.github.com/repos/${this.binaryConfig.repo}/releases?per_page=100&page=${i + 1}`;
const data = await this.requestJSON(url);
if (!Array.isArray(data)) {
// {"message":"API rate limit exceeded for 47.57.239.54. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}
if (typeof data?.message === 'string' && data.message.includes('rate limit')) {
this.logger.info('[GithubBinary.fetch:hit-rate-limit] skip sync this time, data: %j, url: %s', data, url);
return;
}
this.logger.warn('[GithubBinary.fetch:response-data-not-array] data: %j, url: %s', data, url);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion app/core/service/BinarySyncerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class BinarySyncerService extends AbstractService {
logs = [];
} catch (err: any) {
if (err.name === 'DownloadNotFoundError') {
this.logger.warn('Not found %s, skip it', item.sourceUrl);
this.logger.info('Not found %s, skip it', item.sourceUrl);
logs.push(`[${isoNow()}][${dir}] 🧪️ [${parentIndex}${index}] Download ${item.sourceUrl} not found, skip it`);
} else {
this.logger.error('Download binary %s %s', item.sourceUrl, err);
Expand Down
2 changes: 1 addition & 1 deletion app/core/service/ChangesStreamService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class ChangesStreamService extends AbstractService {
// allow disable changesStream dynamic
while (since && this.config.cnpmcore.enableChangesStream) {
const { lastSince, taskCount } = await this.executeSync(since, task);
this.logger.warn('[ChangesStreamService.executeTask:changes] since: %s => %s, %d new tasks, taskId: %s, updatedAt: %j',
this.logger.info('[ChangesStreamService.executeTask:changes] since: %s => %s, %d new tasks, taskId: %s, updatedAt: %j',
since, lastSince, taskCount, task.taskId, task.updatedAt);
since = lastSince;
if (taskCount === 0 && this.config.env === 'unittest') {
Expand Down
2 changes: 1 addition & 1 deletion app/core/service/TaskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class TaskService extends AbstractService {
task.resetLogPath();
}
await this.retryTask(task);
this.logger.warn(
this.logger.info(
'[TaskService.retryExecuteTimeoutTasks:retry] taskType: %s, targetName: %s, taskId: %s, attempts %s will retry again',
task.type, task.targetName, task.taskId, task.attempts);
}
Expand Down
2 changes: 1 addition & 1 deletion app/port/schedule/ChangesStreamWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class ChangesStreamWorker {
if (this.config.cnpmcore.syncMode !== 'all' || !this.config.cnpmcore.enableChangesStream) return;
const task = await this.changesStreamService.findExecuteTask();
if (!task) return;
this.logger.warn('[ChangesStreamWorker:start] taskId: %s', task.taskId);
this.logger.info('[ChangesStreamWorker:start] taskId: %s', task.taskId);
await this.changesStreamService.executeTask(task);
}
}

0 comments on commit a217fd0

Please sign in to comment.