diff --git a/backup.sh b/backup.sh index e504405d..88ad82ea 100755 --- a/backup.sh +++ b/backup.sh @@ -17,7 +17,8 @@ mkdir -p $DIR if [ "$CMD" == "restore" ]; then echo "Running restore from $DIR..." - $BACKUP $DIR restore $(cat .dfx/local/canister_ids.json | jq -r ".taggr.local") $PAGE_START + WEBSERVER_PORT=$(dfx info webserver-port) + DFX_URL="http://localhost:${WEBSERVER_PORT}" $BACKUP $DIR restore $(cat .dfx/local/canister_ids.json | jq -r ".taggr.local") $PAGE_START echo "Clearing buckets before restoring heap..." dfx canister call taggr clear_buckets '("")' || 1 echo "Restoring heap..." diff --git a/backup/src/main.rs b/backup/src/main.rs index cfec2959..6678bda3 100644 --- a/backup/src/main.rs +++ b/backup/src/main.rs @@ -10,7 +10,11 @@ use tokio::fs::File; use tokio::io::AsyncWriteExt; const MAINNET_URL: &str = "https://ic0.app"; -const LOCAL_URL: &str = "http://localhost:8080"; +const LOCAL_URL: &str = "http://localhost:4943"; + +fn get_local_url() -> String { + env::var("DFX_URL").unwrap_or_else(|_| LOCAL_URL.to_string()) +} const FETCH_PAGE_DELAY: Duration = Duration::from_secs(1); enum Command { @@ -73,7 +77,7 @@ async fn restore( }: Args, ) -> Result<(), String> { let agent = Agent::builder() - .with_url(LOCAL_URL) + .with_url(get_local_url()) .build() .map_err(|e| e.to_string())?; diff --git a/src/backend/updates.rs b/src/backend/updates.rs index 5d5a2677..0eb157be 100644 --- a/src/backend/updates.rs +++ b/src/backend/updates.rs @@ -11,7 +11,6 @@ use env::{ canisters::get_full_neuron, config::CONFIG, post::{Extension, Post, PostId}, - storage, user::{Draft, User, UserId}, State, }; @@ -113,9 +112,7 @@ fn post_upgrade() { fn sync_post_upgrade_fixtures() {} #[allow(clippy::all)] -async fn async_post_upgrade_fixtures() { - storage::upgrade_buckets().await; -} +async fn async_post_upgrade_fixtures() {} /* * UPDATES diff --git a/src/bucket/src/lib.rs b/src/bucket/src/lib.rs index f735d3af..7bb0aa0e 100644 --- a/src/bucket/src/lib.rs +++ b/src/bucket/src/lib.rs @@ -15,7 +15,7 @@ mod url; // without trying to read the stable memory. const MAX_BLOB_SIZE: u64 = 8 * 1024 * 1024; -// Minimum remainder size (50KB) to keep when splitting a free segment. +// Minimum remainder size (5KB) to keep when splitting a free segment. const MIN_REMAINDER: u64 = 5 * 1024; // HTTP request and response headers.