File tree Expand file tree Collapse file tree 1 file changed +1
-13
lines changed
Expand file tree Collapse file tree 1 file changed +1
-13
lines changed Original file line number Diff line number Diff line change @@ -121,23 +121,11 @@ func CreateManager(config config.Config) (*Manager, error) {
121121 }
122122 }
123123 }
124- db , err = gorm .Open ("sqlite3" , "/db/region.sqlite3?cache=shared&_busy_timeout=30000 " )
124+ db , err = gorm .Open ("sqlite3" , "/db/region.sqlite3" )
125125 if err != nil {
126126 return nil , err
127127 }
128- // 获取底层的 sql.DB 对象并设置连接池参数
129- sqlDB := db .DB ()
130- // SQLite 应该使用单个写连接来避免锁定问题
131- sqlDB .SetMaxOpenConns (1 )
132- sqlDB .SetMaxIdleConns (1 )
133- sqlDB .SetConnMaxLifetime (0 )
134-
135- // 设置 WAL 模式以提高并发性能
136128 db .Exec ("PRAGMA journal_mode = WAL" )
137- // 设置同步模式为 NORMAL 以提高性能
138- db .Exec ("PRAGMA synchronous = NORMAL" )
139- // 设置 busy_timeout
140- db .Exec ("PRAGMA busy_timeout = 30000" )
141129 }
142130 if config .ShowSQL {
143131 db = db .Debug ()
You can’t perform that action at this time.
0 commit comments