Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

라우터의 순차적인 작업을 다른 작업으로 인식함 #1

Open
KOCEAN33 opened this issue May 4, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@KOCEAN33
Copy link
Owner

KOCEAN33 commented May 4, 2024

newVtuberRouter.addDefaultHandler(async ({ request, page, log }) => {
  // 유튜브 프로필 업데이트
  const { channelId, profile } = await newVtuberScrapeProcess(page, log);
  try {
    await updateNewVtubers(channelId, profile);
  } catch (error) {
    log.error(JSON.stringify(error));
  }

  // 유튜브 라이브 스트리밍 기록 크롤링
  const result = await newChannelScrapeProcess(request, page, log);
  const uniqueItems = result.filter(
    (item: { id: string; title: string }, index: any, self: any[]) =>
      index === self.findIndex((i) => i.id === item.id),
  );
  try {
    await insertVtuberStreams(channelId, uniqueItems);
    log.info(`${profile.name}'s youtube channel update successfully`);
  } catch (e) {
    log.error(`${profile.name}'s database update failed`);
  }
});

유튜브 프로필 업데이트 작업 이후 다른 창에서 진행할 작업이 있을 경우 스트리밍 기록 크롤링 작업은 후순위로 넘기고 다른 작업을 시작함. 이로 인해 유튜브 라이브 스트리밍 기록 크롤링이 시작되지 않은채 작업이 종료 될 수 있음.

@KOCEAN33 KOCEAN33 added the bug Something isn't working label May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant