Skip to content

The Unified and Autonomous Development Platform

Fix the issue of failed to collect auxiliary information upon creating a new repository

robin shine924d7760f59a
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultAuxiliaryManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultAuxiliaryManager.java
index 13e54aa8b8..d6e7d54ad6 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultAuxiliaryManager.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultAuxiliaryManager.java
@@ -356,7 +356,7 @@ public class DefaultAuxiliaryManager implements AuxiliaryManager, DepotListener,
@Override
public void collect(Depot depot, ObjectId commit) {
- final Long repoId = depot.getId();
+ Long depotId = depot.getId();
sequentialWorkManager.execute(getSequentialExecutorKey(depot), new PrioritizedRunnable(PRIORITY) {
@Override
@@ -370,7 +370,7 @@ public class DefaultAuxiliaryManager implements AuxiliaryManager, DepotListener,
@Override
public Void call() throws Exception {
- doCollect(depotManager.load(repoId), commit);
+ doCollect(depotManager.load(depotId), commit);
return null;
}
@@ -653,7 +653,7 @@ public class DefaultAuxiliaryManager implements AuxiliaryManager, DepotListener,
RevObject revObj = revWalk.peel(revWalk.parseAny(ref.getObjectId()));
if (revObj instanceof RevCommit) {
Environment env = getEnv(depot);
- final Store commitsStore = getStore(env, COMMITS_STORE);
+ Store commitsStore = getStore(env, COMMITS_STORE);
boolean collected = env.computeInReadonlyTransaction(new TransactionalComputable<Boolean>() {
@Override
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultDepotManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultDepotManager.java
index 9a90ac96ea..21ea46f074 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultDepotManager.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultDepotManager.java
@@ -34,7 +34,6 @@ import com.pmease.commons.hibernate.Sessional;
import com.pmease.commons.hibernate.Transactional;
import com.pmease.commons.hibernate.dao.AbstractEntityDao;
import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.hibernate.dao.EntityCriteria;
import com.pmease.commons.util.FileUtils;
import com.pmease.commons.util.Pair;
import com.pmease.commons.util.StringUtils;
@@ -184,6 +183,9 @@ public class DefaultDepotManager extends AbstractEntityDao<Depot> implements Dep
} finally {
idLock.writeLock().unlock();
}
+ if (isNew) {
+ auxiliaryManager.collect(depot);
+ }
}
});
@@ -334,8 +336,6 @@ public class DefaultDepotManager extends AbstractEntityDao<Depot> implements Dep
FileUtils.writeFile(gitPostReceiveHookFile, gitPostReceiveHook);
gitPostReceiveHookFile.setExecutable(true);
}
-
- auxiliaryManager.collect(depot);
}
@Sessional
@@ -348,8 +348,9 @@ public class DefaultDepotManager extends AbstractEntityDao<Depot> implements Dep
@Transactional
@Override
public void systemStarted() {
- for (Depot depot: query(EntityCriteria.of(Depot.class), 0, 0)) {
+ for (Depot depot: all()) {
checkSanity(depot);
+ auxiliaryManager.collect(depot);
}
pullRequestManager.checkSanity();