Skip to content

Commit dbe6e74

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Stop writing cron job next run metadata to old location (#36196)
Stop writing to old location - completing migration! GitOrigin-RevId: 34c96bf66f1c8946e0fdea2a3b9ac9160a19b1e1
1 parent 439f4c6 commit dbe6e74

File tree

8 files changed

+91
-33
lines changed

8 files changed

+91
-33
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/convex/Cargo.oss.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ dependencies = [
208208
"base64 0.13.1",
209209
"derive_more",
210210
"headers",
211+
"pretty_assertions",
211212
"proptest",
212213
"proptest-derive",
213214
"rand 0.9.0",

crates/convex/sync_types/Cargo.oss.lock

Lines changed: 81 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ dependencies = [
8585
"base64 0.13.1",
8686
"derive_more",
8787
"headers",
88+
"pretty_assertions",
8889
"proptest",
8990
"proptest-derive",
9091
"rand 0.9.0",
@@ -112,6 +113,16 @@ dependencies = [
112113
"typenum",
113114
]
114115

116+
[[package]]
117+
name = "ctor"
118+
version = "0.1.26"
119+
source = "registry+https://github.com/rust-lang/crates.io-index"
120+
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
121+
dependencies = [
122+
"quote",
123+
"syn 1.0.109",
124+
]
125+
115126
[[package]]
116127
name = "derive_more"
117128
version = "2.0.1"
@@ -130,10 +141,16 @@ dependencies = [
130141
"convert_case",
131142
"proc-macro2",
132143
"quote",
133-
"syn",
144+
"syn 2.0.95",
134145
"unicode-xid",
135146
]
136147

148+
[[package]]
149+
name = "diff"
150+
version = "0.1.13"
151+
source = "registry+https://github.com/rust-lang/crates.io-index"
152+
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
153+
137154
[[package]]
138155
name = "digest"
139156
version = "0.10.7"
@@ -320,12 +337,33 @@ version = "1.20.2"
320337
source = "registry+https://github.com/rust-lang/crates.io-index"
321338
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
322339

340+
[[package]]
341+
name = "output_vt100"
342+
version = "0.1.3"
343+
source = "registry+https://github.com/rust-lang/crates.io-index"
344+
checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66"
345+
dependencies = [
346+
"winapi",
347+
]
348+
323349
[[package]]
324350
name = "ppv-lite86"
325351
version = "0.2.17"
326352
source = "registry+https://github.com/rust-lang/crates.io-index"
327353
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
328354

355+
[[package]]
356+
name = "pretty_assertions"
357+
version = "1.3.0"
358+
source = "registry+https://github.com/rust-lang/crates.io-index"
359+
checksum = "a25e9bcb20aa780fd0bb16b72403a9064d6b3f22f026946029acb941a50af755"
360+
dependencies = [
361+
"ctor",
362+
"diff",
363+
"output_vt100",
364+
"yansi",
365+
]
366+
329367
[[package]]
330368
name = "proc-macro2"
331369
version = "1.0.92"
@@ -363,7 +401,7 @@ checksum = "6ff7ff745a347b87471d859a377a9a404361e7efc2a971d73424a6d183c0fc77"
363401
dependencies = [
364402
"proc-macro2",
365403
"quote",
366-
"syn",
404+
"syn 2.0.95",
367405
]
368406

369407
[[package]]
@@ -505,7 +543,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
505543
dependencies = [
506544
"proc-macro2",
507545
"quote",
508-
"syn",
546+
"syn 2.0.95",
509547
]
510548

511549
[[package]]
@@ -532,6 +570,17 @@ dependencies = [
532570
"digest",
533571
]
534572

573+
[[package]]
574+
name = "syn"
575+
version = "1.0.109"
576+
source = "registry+https://github.com/rust-lang/crates.io-index"
577+
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
578+
dependencies = [
579+
"proc-macro2",
580+
"quote",
581+
"unicode-ident",
582+
]
583+
535584
[[package]]
536585
name = "syn"
537586
version = "2.0.95"
@@ -627,6 +676,28 @@ dependencies = [
627676
"wit-bindgen-rt",
628677
]
629678

679+
[[package]]
680+
name = "winapi"
681+
version = "0.3.9"
682+
source = "registry+https://github.com/rust-lang/crates.io-index"
683+
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
684+
dependencies = [
685+
"winapi-i686-pc-windows-gnu",
686+
"winapi-x86_64-pc-windows-gnu",
687+
]
688+
689+
[[package]]
690+
name = "winapi-i686-pc-windows-gnu"
691+
version = "0.4.0"
692+
source = "registry+https://github.com/rust-lang/crates.io-index"
693+
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
694+
695+
[[package]]
696+
name = "winapi-x86_64-pc-windows-gnu"
697+
version = "0.4.0"
698+
source = "registry+https://github.com/rust-lang/crates.io-index"
699+
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
700+
630701
[[package]]
631702
name = "windows-sys"
632703
version = "0.59.0"
@@ -709,6 +780,12 @@ dependencies = [
709780
"bitflags",
710781
]
711782

783+
[[package]]
784+
name = "yansi"
785+
version = "0.5.1"
786+
source = "registry+https://github.com/rust-lang/crates.io-index"
787+
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
788+
712789
[[package]]
713790
name = "zerocopy"
714791
version = "0.8.20"
@@ -726,5 +803,5 @@ checksum = "eea57037071898bf96a6da35fd626f4f27e9cee3ead2a6c703cf09d472b2e700"
726803
dependencies = [
727804
"proc-macro2",
728805
"quote",
729-
"syn",
806+
"syn 2.0.95",
730807
]

crates/convex/sync_types/Cargo.oss.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ anyhow = { version = "1" }
1515
base64 = { version = "0.13" }
1616
derive_more = { version = "2", features = [ "full" ] }
1717
headers = { version = "0.4" }
18+
pretty_assertions = { optional = true, version = "1" }
1819
proptest = { optional = true, version = "1" }
1920
proptest-derive = { optional = true, version = "0.5.0" }
2021
rand = { version = "0.9" }
@@ -23,11 +24,12 @@ serde_json = { features = [ "float_roundtrip", "preserve_order" ], version = "1"
2324
uuid = { features = [ "serde", "v4" ], version = "1.6" }
2425

2526
[dev-dependencies]
27+
pretty_assertions = { version = "1" }
2628
proptest = { version = "1" }
2729
proptest-derive = { version = "0.5.0" }
2830

2931
[features]
30-
testing = [ "proptest", "proptest-derive" ]
32+
testing = [ "proptest", "proptest-derive", "pretty_assertions" ]
3133

3234
[lints.rust]
3335
unused_extern_crates = "warn"

crates/convex/sync_types/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ anyhow = { workspace = true }
1515
base64 = { workspace = true }
1616
derive_more = { workspace = true }
1717
headers = { workspace = true }
18+
pretty_assertions = { workspace = true, optional = true }
1819
proptest = { workspace = true, optional = true }
1920
proptest-derive = { workspace = true, optional = true }
2021
rand = { workspace = true }
@@ -26,11 +27,12 @@ serde_json = { workspace = true, features = [
2627
uuid = { workspace = true, features = ["serde", "v4"] }
2728

2829
[dev-dependencies]
30+
pretty_assertions = { workspace = true }
2931
proptest = { workspace = true }
3032
proptest-derive = { workspace = true }
3133

3234
[features]
33-
testing = ["proptest", "proptest-derive"]
35+
testing = ["proptest", "proptest-derive", "pretty_assertions"]
3436

3537
[lints]
3638
workspace = true

crates/convex/sync_types/src/testing.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::fmt::Debug;
22

3+
use pretty_assertions::assert_eq;
34
use proptest::prelude::*;
45
use serde_json::Value as JsonValue;
56

crates/model/src/cron_jobs/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,7 @@ impl<'a, RT: Runtime> CronModel<'a, RT> {
248248
) -> anyhow::Result<()> {
249249
let now = self.runtime().generate_timestamp()?;
250250
let next_ts = compute_next_ts(&cron_spec, None, now)?;
251-
let cron = CronJobMetadata {
252-
name,
253-
cron_spec,
254-
state: Some(CronJobState::Pending),
255-
prev_ts: None,
256-
next_ts: Some(next_ts),
257-
};
251+
let cron = CronJobMetadata { name, cron_spec };
258252

259253
let cron_job_id = SystemMetadataModel::new(self.tx, self.component.into())
260254
.insert(&CRON_JOBS_TABLE, cron.try_into()?)
@@ -334,9 +328,6 @@ impl<'a, RT: Runtime> CronModel<'a, RT> {
334328
let cron_job = CronJobMetadata {
335329
name: job.name,
336330
cron_spec: job.cron_spec,
337-
state: Some(job.state),
338-
prev_ts: job.prev_ts,
339-
next_ts: Some(job.next_ts),
340331
};
341332
SystemMetadataModel::new(self.tx, self.component.into())
342333
.replace(job.id, cron_job.try_into()?)

crates/model/src/cron_jobs/types.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,13 @@ pub struct CronJobMetadata {
9696

9797
// Cron-related metadata specified by the user and updated on pushes
9898
pub cron_spec: CronSpec,
99-
100-
// Keep these three fields for now for fwds/backwards compatibility during rollout
101-
pub state: Option<CronJobState>,
102-
pub prev_ts: Option<Timestamp>,
103-
pub next_ts: Option<Timestamp>,
10499
}
105100

106101
#[derive(Serialize, Deserialize)]
107102
#[serde(rename_all = "camelCase")]
108103
pub struct SerializedCronJobMetadata {
109104
name: String,
110105
cron_spec: SerializedCronSpec,
111-
state: Option<CronJobState>,
112-
prev_ts: Option<i64>,
113-
next_ts: Option<i64>,
114106
}
115107

116108
impl TryFrom<CronJobMetadata> for SerializedCronJobMetadata {
@@ -120,9 +112,6 @@ impl TryFrom<CronJobMetadata> for SerializedCronJobMetadata {
120112
Ok(Self {
121113
name: job.name.to_string(),
122114
cron_spec: job.cron_spec.try_into()?,
123-
state: job.state,
124-
prev_ts: job.prev_ts.map(|ts| ts.into()),
125-
next_ts: job.next_ts.map(|ts| ts.into()),
126115
})
127116
}
128117
}
@@ -134,9 +123,6 @@ impl TryFrom<SerializedCronJobMetadata> for CronJobMetadata {
134123
Ok(Self {
135124
name: value.name.parse()?,
136125
cron_spec: value.cron_spec.try_into()?,
137-
state: value.state,
138-
prev_ts: value.prev_ts.map(|ts| ts.try_into()).transpose()?,
139-
next_ts: value.next_ts.map(|ts| ts.try_into()).transpose()?,
140126
})
141127
}
142128
}
@@ -1121,9 +1107,6 @@ mod tests {
11211107
"udfPath" => "crons.js:vacuumOldEntries"
11221108
},
11231109
"name" => "vacuum old entries",
1124-
"nextTs" => 1702354800000000000,
1125-
"prevTs" => 1702268400000000000,
1126-
"state" => {"type" => "pending"},
11271110
);
11281111
assert_roundtrips::<_, CronJobMetadata>(cron_job_obj);
11291112
}

0 commit comments

Comments
 (0)