Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions branch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This branch is for testing build failures in Github actions. DO NOT COMMIT
28 changes: 28 additions & 0 deletions butane_core/src/migrations/fsmigrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ impl MigrationMut for FsMigration {

fn add_type(&mut self, key: TypeKey, sqltype: DeferredSqlType) -> Result<()> {
let _lock = self.lock_exclusive();
eprintln!(
"add type start at {} from process {}",
time_now(),
std::process::id(),
);
let typefile = self.root.join(TYPES_FILENAME);

let mut types: SqlTypeMap = match self.fs.read(&typefile) {
Expand All @@ -258,6 +263,11 @@ impl MigrationMut for FsMigration {
})?
.as_bytes(),
)?;
eprintln!(
"add type end at {} from process {}",
time_now(),
std::process::id(),
);
Ok(())
}

Expand Down Expand Up @@ -524,3 +534,21 @@ impl Drop for MigrationLock {
fs2::FileExt::unlock(&self.file).unwrap();
}
}

// #[test]
// fn cannot_lock_shared_then_exclusive() {
// let path = Path::new("lock_for_test");
// eprintln!("getting first lock shared");
// let _l1 = MigrationLock::new_shared(&path).unwrap();
// eprintln!("getting second lock");
// let _l2 = MigrationLock::new_exclusive(&path).unwrap();
// eprintln!("got second lock");
// }

fn time_now() -> u128 {
use std::time::SystemTime;
SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
.as_millis()
}
1 change: 1 addition & 0 deletions count.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6
Loading