commit 858770e4cb65803ef18230dcc5b34d60a3f711cf
parent 8788261f8c527bbc252b53e873aff840658b2b6d
Author: Yongbin Kim <iam@yongbin.kim>
Date: Sat, 28 Jan 2023 23:35:39 +0900
BREAKING CHANGE: withConnection 함수가 기본적으로 트랜잭션을 사용하도록 수정
기존의 useTransaction 파라메터는 withoutTransaction으로 바뀌어, 반대의 동작을 하게 됨.
Signed-off-by: Yongbin Kim <iam@yongbin.kim>
Diffstat:
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/model_helpers.ts b/lib/model_helpers.ts
@@ -21,13 +21,13 @@ function transactionWrapper<T> (
export async function withConnection<T> (
fn: ConnHandler<T>,
- useTransaction?: boolean,
+ withoutTransaction?: boolean,
): Promise<T> {
const conn = await db.getConnection()
- const handler = useTransaction
- ? transactionWrapper(conn, fn)
- : fn
+ const handler = withoutTransaction
+ ? fn
+ : transactionWrapper(conn, fn)
try {
return await handler(conn)
diff --git a/pages/api/wiki/[slug]/[...path].tsx b/pages/api/wiki/[slug]/[...path].tsx
@@ -130,5 +130,5 @@ async function handlePut (
res.status(200).json({ status: 'ok' })
return
- }, true)
+ }, false)
}