Просмотр исходного кода

Add a healthCheck method to the Bridge, check db

Shane Kilkelly 6 лет назад
Родитель
Сommit
86769eedea
1 измененных файлов с 11 добавлено и 0 удалено
  1. 11 0
      services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/Bridge.java

+ 11 - 0
services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/Bridge.java

@@ -263,6 +263,17 @@ public class Bridge {
         gcJob.start();
         gcJob.start();
     }
     }
 
 
+    public boolean healthCheck() {
+       try {
+         dbStore.getNumProjects();
+         Log.error("[HealthCheck] passed");
+         return true;
+       } catch (Exception e)  {
+         Log.error("[HealthCheck] FAILED!", e);
+         return false;
+       }
+    }
+
     /**
     /**
      * Performs a check of inconsistencies in the DB. This was used to upgrade
      * Performs a check of inconsistencies in the DB. This was used to upgrade
      * the schema.
      * the schema.