Skip to content

Commit bd0730b

Browse files
committed
fix: #268 字段名称与变量名称冲突导致 cpu exceeded time
Signed-off-by: Xeu <thankrain@qq.com>
1 parent ab6a159 commit bd0730b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

server/src/services/feed.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { and, count, desc, eq, like, or } from "drizzle-orm";
2-
import Elysia, { t } from "elysia";
3-
import { XMLParser } from "fast-xml-parser";
1+
import {and, count, desc, eq, like, or} from "drizzle-orm";
2+
import Elysia, {t} from "elysia";
3+
import {XMLParser} from "fast-xml-parser";
44
import html2md from 'html-to-md';
5-
import type { DB } from "../_worker";
6-
import { feeds, visits } from "../db/schema";
7-
import { setup } from "../setup";
8-
import { ClientConfig, PublicCache } from "../utils/cache";
9-
import { getDB } from "../utils/di";
10-
import { extractImage } from "../utils/image";
11-
import { bindTagToPost } from "./tag";
5+
import type {DB} from "../_worker";
6+
import {feeds, visits} from "../db/schema";
7+
import {setup} from "../setup";
8+
import {ClientConfig, PublicCache} from "../utils/cache";
9+
import {getDB} from "../utils/di";
10+
import {extractImage} from "../utils/image";
11+
import {bindTagToPost} from "./tag";
1212

1313
export function FeedService() {
1414
const db: DB = getDB();
@@ -324,12 +324,12 @@ export function FeedService() {
324324
}
325325
const cacheKey = `search_${keyword}`;
326326
const searchKeyword = `%${keyword}%`;
327-
const where = or(like(feeds.title, searchKeyword),
327+
const whereClause = or(like(feeds.title, searchKeyword),
328328
like(feeds.content, searchKeyword),
329-
like(feeds.summary, searchKeyword),
330-
like(feeds.alias, searchKeyword));
329+
like(feeds.summary, searchKeyword),
330+
like(feeds.alias, searchKeyword));
331331
const feed_list = (await cache.getOrSet(cacheKey, () => db.query.feeds.findMany({
332-
where: admin ? where : and(where, eq(feeds.draft, 0)),
332+
where: admin ? whereClause : and(whereClause, eq(feeds.draft, 0)),
333333
columns: admin ? undefined : {
334334
draft: false,
335335
listed: false

0 commit comments

Comments
 (0)