mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-07 19:19:12 +00:00
Factor out key name
This commit is contained in:
parent
8d1cc8815b
commit
c0fb98cb3f
1 changed files with 4 additions and 2 deletions
|
@ -271,13 +271,15 @@ fn main() {
|
|||
}
|
||||
|
||||
async fn installation_id() -> Result<String> {
|
||||
if let Ok(Some(installation_id)) = KEY_VALUE_STORE.read_kvp("device_id") {
|
||||
let legacy_key_name = "device_id";
|
||||
|
||||
if let Ok(Some(installation_id)) = KEY_VALUE_STORE.read_kvp(legacy_key_name) {
|
||||
Ok(installation_id)
|
||||
} else {
|
||||
let installation_id = Uuid::new_v4().to_string();
|
||||
|
||||
KEY_VALUE_STORE
|
||||
.write_kvp("device_id".to_string(), installation_id.clone())
|
||||
.write_kvp(legacy_key_name.to_string(), installation_id.clone())
|
||||
.await?;
|
||||
|
||||
Ok(installation_id)
|
||||
|
|
Loading…
Reference in a new issue