~neon/activity-graph

02a5945245840f7f77a8f1bd018051d4e404846e — Jens Pitkanen 2 years ago 7db00ff
Fix an ordering bug in the server, and add timestamps to logs
3 files changed, 8 insertions(+), 4 deletions(-)

M Cargo.toml
M src/log.rs
M src/server.rs
M Cargo.toml => Cargo.toml +1 -1
@@ 1,6 1,6 @@
[package]
name = "activity-graph"
version = "0.1.0"
version = "0.2.0"
authors = ["Jens Pitkanen <jens@neon.moe>"]
edition = "2018"
description = "Generates a visualization of your commit activity in a set of git repositories."

M src/log.rs => src/log.rs +4 -1
@@ 1,3 1,5 @@
use chrono::{Local, SecondsFormat};

use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Mutex;
use std::time::{Duration, Instant};


@@ 43,7 45,8 @@ pub fn verbose_println(s: &str, updating_line: bool) {
                    *last_update = None;
                }
            }
            eprintln!("{}", s);
            let timestamp = Local::now().to_rfc3339_opts(SecondsFormat::Secs, true);
            eprintln!("[{}] {}", timestamp, s);
        }
    }
}

M src/server.rs => src/server.rs +3 -2
@@ 125,12 125,13 @@ async fn refresh_caches() {
                false,
            );
            REFRESHING_CACHE.store(false, Ordering::Relaxed);
            CACHE_INITIALIZED.store(true, Ordering::Relaxed);
        }
    });

    // If the cache hasn't been initialized yet, wait for the refresh
    // to run by `await`ing it.
    if !CACHE_INITIALIZED.load(Ordering::Relaxed) && task.await.is_ok() {
        CACHE_INITIALIZED.store(true, Ordering::Relaxed);
    if !CACHE_INITIALIZED.load(Ordering::Relaxed) {
        let _ = task.await;
    }
}