refactor: redraw get_clear() use a swap
This commit is contained in:
@@ -145,7 +145,6 @@ impl DockerData {
|
|||||||
)
|
)
|
||||||
.take(1);
|
.take(1);
|
||||||
|
|
||||||
// some err here
|
|
||||||
while let Some(Ok(stats)) = stream.next().await {
|
while let Some(Ok(stats)) = stream.next().await {
|
||||||
// Memory stats are only collected if the container is alive - is this the behaviour we want?
|
// Memory stats are only collected if the container is alive - is this the behaviour we want?
|
||||||
|
|
||||||
@@ -169,7 +168,7 @@ impl DockerData {
|
|||||||
(None, None)
|
(None, None)
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO Is hardcoded eth0 a good idea here?
|
// TODO is hardcoded eth0 a good idea here? - Could use first() instead?
|
||||||
let (rx, tx) = stats.networks.as_ref().map_or((0, 0), |i| {
|
let (rx, tx) = stats.networks.as_ref().map_or((0, 0), |i| {
|
||||||
i.get("eth0").map_or((0, 0), |x| {
|
i.get("eth0").map_or((0, 0), |x| {
|
||||||
(
|
(
|
||||||
|
|||||||
+1
-6
@@ -19,12 +19,7 @@ impl Rerender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_clear(&self) -> bool {
|
pub fn get_clear(&self) -> bool {
|
||||||
if self.clear.load(Ordering::SeqCst) {
|
self.clear.swap(false, Ordering::SeqCst)
|
||||||
self.clear.store(false, Ordering::SeqCst);
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_clear(&self) {
|
pub fn set_clear(&self) {
|
||||||
|
|||||||
Reference in New Issue
Block a user