Skip to content

Commit

Permalink
Debug plan check on document upsert (#1851)
Browse files Browse the repository at this point in the history
  • Loading branch information
lasryaric authored Sep 28, 2023
1 parent efe6b76 commit 288d2a3
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Authenticator, getAPIKey } from "@app/lib/auth";
import { CoreAPI, CoreAPILightDocument } from "@app/lib/core_api";
import { ReturnedAPIErrorType } from "@app/lib/error";
import { validateUrl } from "@app/lib/utils";
import logger from "@app/logger/logger";
import { apiError, withLogging } from "@app/logger/withlogging";
import { DataSourceType } from "@app/types/data_source";
import { DocumentType } from "@app/types/document";
Expand Down Expand Up @@ -226,6 +227,19 @@ async function handler(
// the `getDataSourceDocuments` query involves a SELECT COUNT(*) in the DB that is not
// optimized, so we avoid it for large workspaces if we know we're unlimited anyway
if (owner.plan.limits.dataSources.documents.count != -1) {
logger.info(
{
requestWid: req.query.wId as string,
requestDataSourceName: req.query.name as string,
requestDocumentId: req.query.documentId as string,
planDocumentCount: owner.plan.limits.dataSources.documents.count,
planDocumentCountTypeOf:
typeof owner.plan.limits.dataSources.documents.count,
ownerPlan: JSON.stringify(owner.plan),
owner: owner.sId,
},
"Checking documents count limit"
);
const documents = await CoreAPI.getDataSourceDocuments({
projectId: dataSource.dustAPIProjectId,
dataSourceName: dataSource.name,
Expand Down

0 comments on commit 288d2a3

Please sign in to comment.