From 388130faa4bec54f5684a5bb71867ee52e157ab1 Mon Sep 17 00:00:00 2001 From: Christian Rorvik Date: Fri, 24 Jan 2025 11:28:42 +0100 Subject: [PATCH 1/2] Fix random starting point for object IDs --- .github/workflows/CI.yml | 4 ++-- Project.toml | 2 +- src/LightBSON.jl | 6 ++++++ src/object_id.jl | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e1c5a16..949de3d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,8 +10,8 @@ jobs: fail-fast: false matrix: version: - - '1.7' - - '1.10' + - '1.8' + - '1.11' - 'nightly' os: - ubuntu-latest diff --git a/Project.toml b/Project.toml index 693e77e..18203a3 100644 --- a/Project.toml +++ b/Project.toml @@ -28,7 +28,7 @@ Transducers = "0.4" UUIDs = "1" UnsafeArrays = "1" WeakRefStrings = "1" -julia = "1.7" +julia = "1.8" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/src/LightBSON.jl b/src/LightBSON.jl index a6afe5a..425217d 100644 --- a/src/LightBSON.jl +++ b/src/LightBSON.jl @@ -81,4 +81,10 @@ include("write_buffer.jl") include("convenience.jl") include("fileio.jl") +function __init__() + # Ensure object IDs start at a random point on each run + # Without this the random starting point is burned in at precompile time + global default_object_id_generator = BSONObjectIdGenerator() +end + end diff --git a/src/object_id.jl b/src/object_id.jl index bd798c2..f7741c7 100644 --- a/src/object_id.jl +++ b/src/object_id.jl @@ -117,7 +117,7 @@ end BSONObjectIdIterator(seconds_from_epoch_(), x.rnd, first, first + n) end -const default_object_id_generator = BSONObjectIdGenerator() +default_object_id_generator::BSONObjectIdGenerator = BSONObjectIdGenerator() @inline BSONObjectId() = default_object_id_generator[] From aaf105598a0eeba8ef95843e22385a360de26431 Mon Sep 17 00:00:00 2001 From: Christian Rorvik Date: Fri, 24 Jan 2025 11:29:31 +0100 Subject: [PATCH 2/2] bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 18203a3..c9ca03c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "LightBSON" uuid = "a4a7f996-b3a6-4de6-b9db-2fa5f350df41" authors = ["Christian Rorvik "] -version = "1.0.0" +version = "1.0.1" [deps] DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"