Commit 5cf1882
fix: handle temp file removal race condition in concurrent initializa… (#1185)
* fix: handle temp file removal race condition in concurrent initialization
When multiple SQLPage instances start simultaneously in the same directory,
they can encounter a race condition during initialization. The create_default_database()
function creates a temporary file to test directory writability, then removes it.
If multiple instances try to remove the same file concurrently, some panic with
'No such file or directory'.
This commit replaces the .expect() panic with graceful error handling using
if let Err(). The writability test has already succeeded by the time we try
to remove the file, so whether another instance removed it is irrelevant.
Includes a test that spawns 10 concurrent threads initializing AppConfig
to verify no panics occur.
ref #1183
* cargo fmt
* the error may have another cause
* Remove concurrent initialization test
Removed the test for concurrent initialization. The test did not work
---------
Co-authored-by: lovasoa <contact@ophir.dev>1 parent 8d106fb commit 5cf1882
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
498 | | - | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
499 | 501 | | |
500 | 502 | | |
501 | 503 | | |
| |||
0 commit comments