mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 01:39:21 +03:00
blackbox: preserve session_id when replacing singleton
Summary: The current API replaces `session_id` when the global blackbox switched from in-memory to on-disk. It should preserve the session id. Reviewed By: singhsrb Differential Revision: D17429691 fbshipit-source-id: d37811c3d7622c4f86615c41bce40f4e479eabd2
This commit is contained in:
parent
a108ea0c6f
commit
2b076c4b17
@ -26,7 +26,7 @@ pub struct Blackbox {
|
||||
opts: BlackboxOptions,
|
||||
|
||||
// An ID that can be "grouped by" to figure everything about a session.
|
||||
session_id: u64,
|
||||
pub(crate) session_id: u64,
|
||||
|
||||
// The on-disk files are considered bad (ex. no permissions, or no disk space)
|
||||
// and further write attempts will be ignored.
|
||||
|
@ -20,6 +20,8 @@ lazy_static! {
|
||||
|
||||
/// Replace the global [`Blackbox`] instance.
|
||||
///
|
||||
/// The session ID of the old blackbox will be reused.
|
||||
///
|
||||
/// If [`log`] was called, their side effects will be re-applied to the
|
||||
/// specified blackbox.
|
||||
pub fn init(mut blackbox: Blackbox) {
|
||||
@ -34,6 +36,7 @@ pub fn init(mut blackbox: Blackbox) {
|
||||
}
|
||||
}
|
||||
}
|
||||
blackbox.session_id = old_blackbox.session_id;
|
||||
|
||||
*singleton.deref_mut() = blackbox;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user