mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Move Cluster.apiUrl to seperate injectable (#7354)
* Refactor out Cluster.apiUrl to direct reading - Should help prevent using stale data - Removes some uses of synchronous FS operations Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * Rename helper function to better communicate intent Signed-off-by: Sebastian Malton <sebastian@malton.name> * Improve prometheus handler tests to override less things Signed-off-by: Sebastian Malton <sebastian@malton.name> --------- Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
18d660ea77
commit
fe2fd4c1fd
53 files changed
+472
-640
No files matched your search
@@ -85,6 +85,15 @@ export async function getOrInsertWithAsync<K, V>(map: Map<K, V>, key: K, asyncBu
|
||||
return map.get(key)!;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert `val` into `map` under `key` and then get the value back
|
||||
*/
|
||||
export function setAndGet<K, V>(map: Map<K, V>, key: K, val: V): V {
|
||||
map.set(key, val);
|
||||
|
||||
return map.get(key)!;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value associated with `key` iff there was not a previous value
|
||||
* @param map The map to interact with
|
||||
|
||||
Reference in new issue
Block a user