mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
blackbox: do not inherit session_id if pid has changed
Summary: D17429691 made blackbox reuse session_id unconditionally. That has an undesirable side effect that chg processes are all logged as a same session id. Fix that by detecting pid change and avoid reusing session_id in that case. Reviewed By: singhsrb Differential Revision: D17532555 fbshipit-source-id: cf11bb66f7d7242429b90ab5e5ea85ca307f92c3
This commit is contained in:
parent
7db4a13b5f
commit
ab3da9107c
@ -175,6 +175,11 @@ impl Blackbox {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the pid stored in session_id.
|
||||
pub(crate) fn session_pid(&self) -> u32 {
|
||||
(self.session_id & 0xffffff) as u32
|
||||
}
|
||||
|
||||
pub fn session_id(&self) -> u64 {
|
||||
self.session_id
|
||||
}
|
||||
|
@ -36,7 +36,11 @@ pub fn init(mut blackbox: Blackbox) {
|
||||
}
|
||||
}
|
||||
}
|
||||
blackbox.session_id = old_blackbox.session_id;
|
||||
|
||||
// Perserve session_id if pid hasn't been changed.
|
||||
if blackbox.session_pid() == old_blackbox.session_pid() {
|
||||
blackbox.session_id = old_blackbox.session_id;
|
||||
}
|
||||
|
||||
*singleton.deref_mut() = blackbox;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user