-
Notifications
You must be signed in to change notification settings - Fork 875
feat(git-sync): sync jobs debouncing [merge-ee-first] #7489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
cba8eb1
5ea39ea
16776cd
a48fe4b
e139509
d381866
8967f1d
10fea1d
61849ec
ed3ebc5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 5c2a8854e7ff014063a69dd8f7829a935129c31e | ||
| a46502cd9e494c67866ec9095a49bb1873448eb1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize}; | |
| use strum::AsRefStr; | ||
|
|
||
| use crate::{ | ||
| error::{to_anyhow, Error, Result}, | ||
| error::{self, to_anyhow, Error, Result}, | ||
| get_database_url, | ||
| utils::get_custom_pg_instance_password, | ||
| variables::{build_crypt, decrypt}, | ||
|
|
@@ -63,6 +63,31 @@ pub struct GitRepositorySettings { | |
| pub settings: Option<GitSyncSettings>, | ||
| } | ||
|
|
||
| impl GitRepositorySettings { | ||
| pub fn is_script_meets_min_version(&self, min_version: u32) -> error::Result<bool> { | ||
| // example: "hub/28102/sync-script-to-git-repo-windmill" | ||
| let current: u32 = self | ||
| .script_path | ||
| .split("/") // -> ["hub" "28102" "sync-script-to-git-repo-windmill"] | ||
pyranota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .skip(1) // emit "hub" | ||
pyranota marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| .next() // get numeric id | ||
| .ok_or(Error::InternalErr(format!( | ||
| "cannot get script version id from: {}", | ||
| &self.script_path | ||
| ))) | ||
| .and_then(|s| { | ||
| s.parse().map_err(|e| { | ||
| Error::InternalErr(format!( | ||
| "cannot get script version id from: {}. e: {e}", | ||
| &self.script_path | ||
| )) | ||
| }) | ||
| })?; | ||
|
|
||
| Ok(current >= min_version) // this works on assumption that all scripts in hub have sequential ids | ||
| } | ||
|
Comment on lines
67
to
89
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Concern: Assumption about sequential hub script IDs The comment states this "works on assumption that all scripts in hub have sequential ids". This assumption may be fragile:
Consider adding more robust error handling or documentation about when this method should be called and what guarantees exist about hub script ID ordering. |
||
| } | ||
|
|
||
| #[derive(Serialize, Deserialize, Debug)] | ||
| pub struct GitSyncSettings { | ||
| pub include_path: Vec<String>, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.