Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsm committed Sep 28, 2024
1 parent 8c74161 commit 8349762
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rocketmq-client/src/consumer/store/local_file_offset_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ use crate::Result;

static LOCAL_OFFSET_STORE_DIR: Lazy<PathBuf> = Lazy::new(|| {
#[cfg(target_os = "windows")]
let home = std::env::var("user.home")
let home = std::env::var("USERPROFILE")
.map_or(PathBuf::from("C:\\tmp\\.rocketmq_offsets"), |home| {
PathBuf::from(home).join(".rocketmq_offsets")
});

#[cfg(not(target_os = "windows"))]
let home = std::env::var("user.home").map_or(PathBuf::from("/tmp/.rocketmq_offsets"), |home| {
let home = std::env::var("HOME").map_or(PathBuf::from("/tmp/.rocketmq_offsets"), |home| {
PathBuf::from(home).join(".rocketmq_offsets")
});

Expand Down Expand Up @@ -83,9 +83,9 @@ impl LocalFileOffsetStore {
} else {
match OffsetSerializeWrapper::decode(content.as_bytes()) {
Ok(value) => Ok(Some(value)),
Err(_) => Err(MQClientError::MQClientErr(
Err(e) => Err(MQClientError::MQClientErr(
-1,
format!("read local offset failed, content: {}", content),
format!("Failed to deserialize local offset: {}", e),
)),
}
}
Expand Down

0 comments on commit 8349762

Please sign in to comment.