mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-06 01:27:24 +03:00
feat: optimize code push check to only push if sync is enabled and code URL is present
This commit is contained in:
parent
67cea3c292
commit
018a480f3f
@ -89,15 +89,20 @@ impl Handler {
|
||||
}
|
||||
}
|
||||
|
||||
let project_code_last_push = project
|
||||
.gitbutler_code_push_state
|
||||
.as_ref()
|
||||
.map(|state| &state.timestamp)
|
||||
.copied()
|
||||
.unwrap_or(time::UNIX_EPOCH);
|
||||
let should_push_code = project_repository.project().is_sync_enabled()
|
||||
&& project_repository.project().has_code_url();
|
||||
|
||||
if now.duration_since(project_code_last_push)? > PROJECT_PUSH_INTERVAL {
|
||||
events.push(events::Event::PushProjectToGitbutler(*project_id));
|
||||
if should_push_code {
|
||||
let project_code_last_push = project
|
||||
.gitbutler_code_push_state
|
||||
.as_ref()
|
||||
.map(|state| &state.timestamp)
|
||||
.copied()
|
||||
.unwrap_or(time::UNIX_EPOCH);
|
||||
|
||||
if now.duration_since(project_code_last_push)? > PROJECT_PUSH_INTERVAL {
|
||||
events.push(events::Event::PushProjectToGitbutler(*project_id));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(events)
|
||||
|
Loading…
Reference in New Issue
Block a user