src/server/worker_task.rs: set worker thread name

This gives better logs on thread panic...
This commit is contained in:
Dietmar Maurer 2019-12-19 07:07:39 +01:00
parent 7e210bd0b4
commit 217170e11e

View File

@ -439,7 +439,7 @@ impl WorkerTask {
let worker = WorkerTask::new(worker_type, worker_id, username, to_stdout)?; let worker = WorkerTask::new(worker_type, worker_id, username, to_stdout)?;
let upid_str = worker.upid.to_string(); let upid_str = worker.upid.to_string();
let _child = std::thread::spawn(move || { let _child = std::thread::Builder::new().name(upid_str.clone()).spawn(move || {
let worker1 = worker.clone(); let worker1 = worker.clone();
let result = match std::panic::catch_unwind(move || f(worker1)) { let result = match std::panic::catch_unwind(move || f(worker1)) {
Ok(r) => r, Ok(r) => r,