Skip to content

Commit

Permalink
[connector] fix: Add heartbeat in webcrawler (#5871)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdraier authored Jun 26, 2024
1 parent bdf6b42 commit 58d890c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions connectors/src/connectors/webcrawler/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export async function crawlWebsiteByConnectorId(connectorId: ModelId) {
navigationTimeoutSecs: 10,
preNavigationHooks: [
async (crawlingContext) => {
Context.current().heartbeat({
type: "pre_navigation",
});

const { address, family } = await getIpAddressForUrl(
crawlingContext.request.url
);
Expand Down Expand Up @@ -318,6 +322,9 @@ export async function crawlWebsiteByConnectorId(connectorId: ModelId) {
await reportInitialSyncProgress(connector.id, `${pageCount} pages`);
},
failedRequestHandler: async (context, error) => {
Context.current().heartbeat({
type: "failed_request",
});
childLogger.error(
{
url: context.request.url,
Expand Down

0 comments on commit 58d890c

Please sign in to comment.