This repository was archived by the owner on Jun 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ import dataDir from "./data_dir.js";
10
10
import cls from "./cls.js" ;
11
11
import fs from "fs-extra" ;
12
12
import Database from "better-sqlite3" ;
13
+ import ws from "./ws.js" ;
14
+ import becca_loader from "../becca/becca_loader.js" ;
15
+ import entity_changes from "./entity_changes.js" ;
13
16
14
17
const dbConnection : DatabaseType = new Database ( dataDir . DOCUMENT_PATH ) ;
15
18
dbConnection . pragma ( 'journal_mode = WAL' ) ;
@@ -248,7 +251,7 @@ function transactional<T>(func: (statement: Statement) => T) {
248
251
const ret = ( dbConnection . transaction ( func ) as any ) . deferred ( ) ;
249
252
250
253
if ( ! dbConnection . inTransaction ) { // i.e. transaction was really committed (and not just savepoint released)
251
- require ( './ws' ) . sendTransactionEntityChangesToAllClients ( ) ;
254
+ ws . sendTransactionEntityChangesToAllClients ( ) ;
252
255
}
253
256
254
257
return ret ;
@@ -259,11 +262,11 @@ function transactional<T>(func: (statement: Statement) => T) {
259
262
if ( entityChangeIds . length > 0 ) {
260
263
log . info ( "Transaction rollback dirtied the becca, forcing reload." ) ;
261
264
262
- require ( '../becca/ becca_loader' ) . load ( ) ;
265
+ becca_loader . load ( ) ;
263
266
}
264
267
265
268
// the maxEntityChangeId has been incremented during failed transaction, need to recalculate
266
- require ( './ entity_changes' ) . recalculateMaxEntityChangeId ( ) ;
269
+ entity_changes . recalculateMaxEntityChangeId ( ) ;
267
270
268
271
throw e ;
269
272
}
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import becca from "../becca/becca.js";
20
20
import { EntityChange , EntityChangeRecord , EntityRow } from './entity_changes_interface' ;
21
21
import { CookieJar , ExecOpts } from './request_interface' ;
22
22
import setupService from "./setup.js" ;
23
+ import consistency_checks from "./consistency_checks.js" ;
23
24
24
25
let proxyToggle = true ;
25
26
@@ -281,8 +282,7 @@ async function checkContentHash(syncContext: SyncContext) {
281
282
282
283
if ( failedChecks . length > 0 ) {
283
284
// before re-queuing sectors, make sure the entity changes are correct
284
- const consistencyChecks = require ( './consistency_checks' ) ;
285
- consistencyChecks . runEntityChangesChecks ( ) ;
285
+ consistency_checks . runEntityChangesChecks ( ) ;
286
286
287
287
await syncRequest ( syncContext , 'POST' , `/api/sync/check-entity-changes` ) ;
288
288
}
Original file line number Diff line number Diff line change @@ -250,8 +250,6 @@ function register(router: Router) {
250
250
251
251
addNoIndexHeader ( note , res ) ;
252
252
253
- const utils = require ( '../services/utils' ) ;
254
-
255
253
const filename = utils . formatDownloadTitle ( note . title , note . type , note . mime ) ;
256
254
257
255
res . setHeader ( 'Content-Disposition' , utils . getContentDisposition ( filename ) ) ;
You can’t perform that action at this time.
0 commit comments