Skip to content

Commit

Permalink
오류 위치 특정을 위한 디버깅 코드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-maki committed May 17, 2024
1 parent 4a7cb72 commit 786bd62
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions apps/website/src/lib/server/graphql/schemas/post.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { init as cuid } from '@paralleldrive/cuid2';
import * as Sentry from '@sentry/sveltekit';
import { hash, verify } from 'argon2';
import dayjs from 'dayjs';
import { and, asc, count, desc, eq, exists, gt, gte, isNotNull, isNull, lt, ne, notExists, or, sql } from 'drizzle-orm';
Expand All @@ -20,7 +21,7 @@ import {
PostTagKind,
PostVisibility,
} from '$lib/enums';
import { FormValidationError, IntentionalError, NotFoundError, PermissionDeniedError } from '$lib/errors';
import { FormValidationError, IntentionalError, NotFoundError, PermissionDeniedError, UnknownError } from '$lib/errors';
import { redis } from '$lib/server/cache';
import {
BookmarkGroupPosts,
Expand Down Expand Up @@ -2035,29 +2036,38 @@ builder.subscriptionFields((t) => ({
}
}

return pipe(
Repeater.merge([
pubsub.subscribe('post:synchronization', args.postId),
new Repeater<SynchronizePostResultType>(async (push, stop) => {
push({
postId: args.postId,
kind: 'PING',
data: dayjs().valueOf().toString(),
});

const interval = setInterval(() => {
try {
return pipe(
Repeater.merge([
pubsub.subscribe('post:synchronization', args.postId),
new Repeater<SynchronizePostResultType>(async (push, stop) => {
push({
postId: args.postId,
kind: 'PING',
data: dayjs().valueOf().toString(),
});
}, 1000);

await stop;
clearInterval(interval);
}),
]),
);
const interval = setInterval(() => {
push({
postId: args.postId,
kind: 'PING',
data: dayjs().valueOf().toString(),
});
}, 1000);

await stop;
clearInterval(interval);
}),
]),
);
} catch (err) {
const errId = Sentry.captureException(err, {
tags: {
section: 'gql_subscription_postSynchronization',
},
});
throw new UnknownError(err, errId);
}
},
resolve: (payload) => payload,
}),
Expand Down

0 comments on commit 786bd62

Please sign in to comment.