feat: add per-account lock file protection via fs2
Prevent running multiple tele-tui instances with the same account by using advisory file locks (flock). Lock is acquired before raw mode so errors print to normal terminal. Account switching acquires new lock before releasing old. Also log set_tdlib_parameters errors via tracing instead of silently discarding them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -665,7 +665,7 @@ impl TdClient {
|
||||
let db_path_str = new_client.db_path.to_string_lossy().to_string();
|
||||
|
||||
tokio::spawn(async move {
|
||||
let _ = functions::set_tdlib_parameters(
|
||||
if let Err(e) = functions::set_tdlib_parameters(
|
||||
false,
|
||||
db_path_str,
|
||||
"".to_string(),
|
||||
@@ -682,7 +682,10 @@ impl TdClient {
|
||||
env!("CARGO_PKG_VERSION").to_string(),
|
||||
new_client_id,
|
||||
)
|
||||
.await;
|
||||
.await
|
||||
{
|
||||
tracing::error!("set_tdlib_parameters failed on recreate: {:?}", e);
|
||||
}
|
||||
});
|
||||
|
||||
// 4. Replace self
|
||||
|
||||
Reference in New Issue
Block a user