mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
Improve repo permission syncer logs
This commit is contained in:
parent
bad7757a62
commit
05c3d139bc
1 changed files with 9 additions and 1 deletions
|
|
@ -17,7 +17,9 @@ type RepoPermissionSyncJob = {
|
||||||
|
|
||||||
const QUEUE_NAME = 'repoPermissionSyncQueue';
|
const QUEUE_NAME = 'repoPermissionSyncQueue';
|
||||||
|
|
||||||
const logger = createLogger('repo-permission-syncer');
|
const LOG_TAG = 'repo-permission-syncer';
|
||||||
|
const logger = createLogger(LOG_TAG);
|
||||||
|
const createJobLogger = (jobId: string) => createLogger(`${LOG_TAG}:job:${jobId}`);
|
||||||
|
|
||||||
export class RepoPermissionSyncer {
|
export class RepoPermissionSyncer {
|
||||||
private queue: Queue<RepoPermissionSyncJob>;
|
private queue: Queue<RepoPermissionSyncJob>;
|
||||||
|
|
@ -133,6 +135,8 @@ export class RepoPermissionSyncer {
|
||||||
|
|
||||||
private async runJob(job: Job<RepoPermissionSyncJob>) {
|
private async runJob(job: Job<RepoPermissionSyncJob>) {
|
||||||
const id = job.data.jobId;
|
const id = job.data.jobId;
|
||||||
|
const logger = createJobLogger(id);
|
||||||
|
|
||||||
const { repo } = await this.db.repoPermissionSyncJob.update({
|
const { repo } = await this.db.repoPermissionSyncJob.update({
|
||||||
where: {
|
where: {
|
||||||
id,
|
id,
|
||||||
|
|
@ -250,6 +254,8 @@ export class RepoPermissionSyncer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onJobCompleted(job: Job<RepoPermissionSyncJob>) {
|
private async onJobCompleted(job: Job<RepoPermissionSyncJob>) {
|
||||||
|
const logger = createJobLogger(job.data.jobId);
|
||||||
|
|
||||||
const { repo } = await this.db.repoPermissionSyncJob.update({
|
const { repo } = await this.db.repoPermissionSyncJob.update({
|
||||||
where: {
|
where: {
|
||||||
id: job.data.jobId,
|
id: job.data.jobId,
|
||||||
|
|
@ -272,6 +278,8 @@ export class RepoPermissionSyncer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onJobFailed(job: Job<RepoPermissionSyncJob> | undefined, err: Error) {
|
private async onJobFailed(job: Job<RepoPermissionSyncJob> | undefined, err: Error) {
|
||||||
|
const logger = createJobLogger(job?.data.jobId ?? 'unknown');
|
||||||
|
|
||||||
Sentry.captureException(err, {
|
Sentry.captureException(err, {
|
||||||
tags: {
|
tags: {
|
||||||
jobId: job?.data.jobId,
|
jobId: job?.data.jobId,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue