diba-io / bitmask-core

Core functionality for the BitMask wallet
https://bitmask.app
Other
93 stars 21 forks source link

Use a database and JSON file for persistent, multi-day, live metrics. #440

Closed cryptoquick closed 6 months ago

cryptoquick commented 6 months ago

This should be a superior approach that addresses a concern @crisdut raised about using a Lazy RwLock and also should lessen the burden on the server.

Supersedes #438

josediegorobles commented 6 months ago

Lots of tests are failing

crisdut commented 6 months ago

Lots of tests are failing

I will check this. The error being described is related to file manipulation.

cryptoquick commented 6 months ago

@crisdut Can you check if bitmaskd isn't being instantiated in time for it to ensure the directory is initialized for backend integration tests?

crisdut commented 6 months ago

Can you check if bitmaskd isn't being instantiated in time for it to ensure the directory is initialized for backend integration tests?

We instance bitmaskd only for wasm32 tests. For integration tests, we call functions directly.

We need a verification like this:

    let dir = env::var("CARBONADO_DIR").unwrap_or("/tmp/bitmaskd/carbonado".to_owned());
    if !Path::new(&format!("{dir}/metrics.json")).exists()
        || !Path::new(&format!("{dir}/metrics.csv")).exists()
    {
        init(Path::new(&dir)).await?;
    }