Skip to content

Commit 3552261

Browse files
committed
Temporary ignore large repository to fix OOM during trigger update
1 parent 92f4ae7 commit 3552261

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/server/trigger_update.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::collections::HashSet;
22
use std::fs;
3+
use std::ops::Deref;
34
use std::path::Path;
45
use std::sync::LazyLock;
56
use std::time::Duration;
@@ -17,6 +18,13 @@ use crate::github_repo_info::{GithubModName, GithubRepoInfo};
1718
use crate::mod_directory::ModDirectory;
1819
use crate::server::check_secret;
1920

21+
const TRIGGER_UPDATE_IGNORED_REPOSITORIES: &[&str] = &[
22+
// TODO:
23+
// Large repository, causes OOM for some reason
24+
// https://github.com/dima74/factorio-mods-localization/issues/25
25+
"robot256/cargo_ships",
26+
];
27+
2028
#[get("/triggerUpdate?<repo>&<subpath>&<secret>")]
2129
pub async fn trigger_update(
2230
repo: Option<String>,
@@ -106,10 +114,18 @@ fn filter_repositories_for_update_all(
106114
) -> Vec<(GithubRepoInfo, InstallationId)> {
107115
repositories
108116
.retain(|(repo_info, _)| {
117+
if TRIGGER_UPDATE_IGNORED_REPOSITORIES.contains(&repo_info.full_name.deref()) {
118+
info!(
119+
"[update-github-from-crowdin] [{}] skipping update (ignored)",
120+
repo_info.full_name
121+
);
122+
return false;
123+
};
124+
109125
let weekly_update_from_crowdin = repo_info.weekly_update_from_crowdin;
110126
if !weekly_update_from_crowdin {
111127
info!(
112-
"[update-github-from-crowdin] [{}] skipping update because weekly_update_from_crowdin=false",
128+
"[update-github-from-crowdin] [{}] skipping update because weekly_update_from_crowdin=false",
113129
repo_info.full_name
114130
);
115131
}
@@ -178,7 +194,7 @@ async fn move_translated_files_to_mod_directory(mod_directory: &ModDirectory, tr
178194
delete_unmatched_localization_files(mod_directory);
179195
for (language_path, language) in util::read_dir(translation_directory) {
180196
if !language_is_enabled_for_mod_on_crowdin(&mod_directory.github_name, &language) { continue; }
181-
197+
182198
let language_path_crowdin = language_path.join(get_crowdin_directory_name(&mod_directory.github_name));
183199
assert!(language_path_crowdin.exists());
184200
let files = util::read_dir(&language_path_crowdin).collect::<Vec<_>>();
@@ -226,6 +242,6 @@ fn language_is_enabled_for_mod_on_crowdin(github_name: &GithubModName, language:
226242
if github_name.owner == "PennyJim" && github_name.repo == "pirate-locale" {
227243
return language == "fr";
228244
}
229-
245+
230246
true
231247
}

0 commit comments

Comments
 (0)