danylokhodus commited on
Commit
f21fc8a
·
1 Parent(s): 8ad9904

fix: apply aggressive SQLite stability settings (EXCLUSIVE lock, MEMORY journal) to resolve disk I/O errors on HF Spaces

Browse files
Files changed (2) hide show
  1. FlowAPI/Program.cs +3 -2
  2. FlowAPI/appsettings.json +1 -1
FlowAPI/Program.cs CHANGED
@@ -136,11 +136,12 @@ namespace FlowAPI
136
 
137
  db.Database.Migrate();
138
 
139
- // Set journal mode to TRUNCATE for better compatibility with Docker/Cloud filesystems while keeping performance
140
  using (var command = db.Database.GetDbConnection().CreateCommand())
141
  {
142
  db.Database.OpenConnection();
143
- command.CommandText = "PRAGMA journal_mode=TRUNCATE; PRAGMA synchronous=NORMAL; PRAGMA locking_mode=NORMAL; PRAGMA temp_store=MEMORY;";
 
144
  command.ExecuteNonQuery();
145
  }
146
 
 
136
 
137
  db.Database.Migrate();
138
 
139
+ // Aggressive stability PRAGMAs for Cloud/Docker filesystems (Hugging Face)
140
  using (var command = db.Database.GetDbConnection().CreateCommand())
141
  {
142
  db.Database.OpenConnection();
143
+ // journal_mode=MEMORY and locking_mode=EXCLUSIVE bypass most disk-locking issues
144
+ command.CommandText = "PRAGMA journal_mode=MEMORY; PRAGMA synchronous=OFF; PRAGMA locking_mode=EXCLUSIVE; PRAGMA temp_store=MEMORY; PRAGMA cache_size=-20000;";
145
  command.ExecuteNonQuery();
146
  }
147
 
FlowAPI/appsettings.json CHANGED
@@ -8,7 +8,7 @@
8
  },
9
  "AllowedHosts": "*",
10
  "ConnectionStrings": {
11
- "DefaultConnection": "Data Source=taskflow.db;Cache=Shared;Busy Timeout=5000"
12
  },
13
  "Jwt": {
14
  "Key": "TaskFlow_Secret_Key_For_JWT_Authentication_2026_!@#",
 
8
  },
9
  "AllowedHosts": "*",
10
  "ConnectionStrings": {
11
+ "DefaultConnection": "Data Source=/app/taskflow.db;Cache=Shared;Busy Timeout=10000"
12
  },
13
  "Jwt": {
14
  "Key": "TaskFlow_Secret_Key_For_JWT_Authentication_2026_!@#",