Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit fc41ab0

Browse files
CloverFoxamis92
authored andcommitted
tentative fix for #208 (#231)
* added intellij project files to .gitignore * For now we'll just catch the exception and continue on, if this fixes the problem we can look into a more elegant solution
1 parent 41af6db commit fc41ab0

File tree

2 files changed

+37
-18
lines changed

2 files changed

+37
-18
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ build/
66
dist/
77
target/
88
nbproject/
9+
.idea
10+
*.iml
911
nb-configuration.xml
1012
maven.properties
1113
github-user.properties

src/main/java/org/battlescribedata/dao/GitHubDao.java

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -204,27 +204,44 @@ private void refreshRepositoriesAsync() {
204204
// We are currently updating the repos
205205
return;
206206
}
207-
207+
208208
ThreadFactory threadFactory = com.google.appengine.api.ThreadManager.backgroundThreadFactory();
209209
ExecutorService executorService = Executors.newSingleThreadExecutor(threadFactory);
210-
Future<Void> future = executorService.submit(new Callable<Void>() {
211-
212-
@Override
213-
public Void call() throws IOException {
214-
try {
215-
refreshRepositories();
216-
}
217-
catch (IOException e) {
218-
logger.log(
219-
Level.SEVERE,
220-
"Failed to update repositories",
221-
e);
210+
Future<Void> future;
211+
try {
212+
/*
213+
This line seems to be tha cause of Appspot failing to update some repos, we receive
214+
"IllegalStateException "Limit on the number of active background threads was reached for this app version"
215+
which seems to be because the timeout doesnt kill the thread, and since we have a max thread count of 10,
216+
causes some problems. We can't just kill the Thread as we don't know the knock on effects that might have
217+
For now we'll just catch the exception and continue on, if this fixes the problem we can look into a more
218+
elegant solution
219+
*/
220+
future = executorService.submit(new Callable<Void>() {
221+
222+
@Override
223+
public Void call() {
224+
try {
225+
refreshRepositories();
226+
} catch (IOException e) {
227+
logger.log(
228+
Level.SEVERE,
229+
"Failed to update repositories",
230+
e);
231+
}
232+
233+
return null;
222234
}
223-
224-
return null;
225-
}
226-
});
227-
235+
});
236+
} catch (Exception e) {
237+
logger.log(
238+
Level.WARNING,
239+
"Problem submitting repository refresh task",
240+
e);
241+
// if we can't submit the task, there's no point on continuing
242+
return;
243+
}
244+
228245
try {
229246
future.get(5, TimeUnit.MINUTES);
230247
}

0 commit comments

Comments
 (0)