feat(crawler): fix async crawling

This commit is contained in:
2025-11-09 01:01:07 +02:00
parent e8c0f0422b
commit 2b5482e9f5
58 changed files with 243 additions and 169 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
import * as schema from "@/schema";
const isDevelopment = process.env.NODE_ENV === "development";
@@ -21,7 +22,7 @@ const pool = new Pool({
export const getConnectionPoolStats = () => {
const stats = {
active: Math.max(0, (pool.totalCount ?? 0) - (pool.idleCount ?? 0)),
ended: (pool as any).ended ?? false,
ended: pool.ended ?? false,
idle: pool.idleCount ?? 0,
name: "primary",
total: pool.options.max ?? 0,
+3 -3
View File
@@ -4,13 +4,13 @@ import { and, asc, desc, eq, gt, lt, or, sql } from "drizzle-orm";
import type { Database } from "@/client";
import { articles, bookmarkArticles, bookmarks, comments, sources, users } from "@/schema";
import {
buildPaginationResult,
createPageState,
decodeCursor,
type PageRequest,
type PageState,
type PaginationMeta,
type SortDirection,
buildPaginationResult,
createPageState,
decodeCursor,
} from "@/utils/pagination";
export interface ArticleFilters {
+2 -2
View File
@@ -4,11 +4,11 @@ import { and, desc, eq, lt, sql } from "drizzle-orm";
import type { Database } from "@/client";
import { bookmarkArticles, bookmarks } from "@/schema";
import {
type PageRequest,
type PaginationMeta,
buildPaginationResult,
createPageState,
decodeCursor,
type PageRequest,
type PaginationMeta,
} from "@/utils/pagination";
export interface BookmarkRow {
+2 -2
View File
@@ -5,11 +5,11 @@ import type { Database } from "@/client";
import { PUBLICATION_GRAPH_DAYS, SOURCE_IMAGE_BASE } from "@/constant";
import { articles, followedSources, sources } from "@/schema";
import {
type PageRequest,
type PaginationMeta,
buildPaginationResult,
createPageState,
decodeCursor,
type PageRequest,
type PaginationMeta,
} from "@/utils/pagination";
export interface SourceOverviewRow {
+1
View File
@@ -1,4 +1,5 @@
import { sql } from "drizzle-orm";
import { db } from "@/client";
export async function checkHealth() {
+4 -3
View File
@@ -7,14 +7,15 @@
"incremental": false,
"isolatedModules": true,
"lib": ["es2022", "DOM", "DOM.Iterable"],
"module": "NodeNext",
"module": "ESNext",
"moduleDetection": "force",
"moduleResolution": "NodeNext",
"moduleResolution": "Bundler",
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2022"
"target": "ES2022",
"verbatimModuleSyntax": false
},
"display": "Default"
}
+1 -1
View File
@@ -1,6 +1,6 @@
import { cn } from "@basango/ui/lib/utils";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import { type VariantProps, cva } from "class-variance-authority";
import * as React from "react";
const buttonVariants = cva(