Skip to content

Commit

Permalink
fixed Domain model
Browse files Browse the repository at this point in the history
  • Loading branch information
andrefs committed Oct 18, 2023
1 parent 4a10533 commit 82a1eab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/models/Domain.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { UpdateOneModel } from 'mongodb';
import { HttpError, UrlType, createLogger } from '@derzis/common';
import { HttpError, createLogger } from '@derzis/common';
import {
DomainCrawlJobInfo,
RobotsCheckResultError,
RobotsCheckResultOk,
} from '@derzis/worker';
import { Counter } from './Counter';
import { Path } from './Path';
import { Path, PathDocument } from './Path';
import { Process } from './Process';
import { Resource } from './Resource';
import {
Expand Down Expand Up @@ -147,7 +147,7 @@ class DomainClass {

if (jobResult.err.errorType === 'host_not_found') {
for await (const path of Path.find({ 'head.domain': jobResult.origin })) {
await path.markDisabled();
// await path.markDisabled(); // TODO make sure this was not needed
d = await this.findOneAndUpdate(
{ origin: jobResult.origin },
{ $inc: { 'crawl.pathHeads': -1 } },
Expand Down Expand Up @@ -329,7 +329,7 @@ class DomainClass {
let pathSkip = 0;
// iterate over process' paths
PATHS_LOOP: while (domainsFound < domLimit) {
const paths = await proc.getPaths(pathSkip, pathLimit);
const paths: PathDocument[] = await proc.getPaths(pathSkip, pathLimit);

// if this process has no more available paths, skip it
if (!paths.length) {
Expand Down
4 changes: 2 additions & 2 deletions src/models/Process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Resource } from './Resource';
import { Triple, TripleClass } from './Triple';
import { humanize } from 'humanize-digest';
import { Domain } from './Domain';
import { PathClass, Path } from './Path';
import { PathClass, Path, PathDocument } from './Path';
import { ProcessTriple } from './ProcessTriple';
import {
prop,
Expand Down Expand Up @@ -117,7 +117,7 @@ class ProcessClass {
}

public async getPaths(skip = 0, limit = 20) {
const paths = await Path.find({
const paths: PathDocument[] = await Path.find({
processId: this.pid,
'nodes.count': { $lt: this.params.maxPathLength },
'predicates.count': { $lte: this.params.maxPathProps },
Expand Down

0 comments on commit 82a1eab

Please sign in to comment.