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

Add a healthCheck method to the Bridge, check db

Shane Kilkelly 6 лет назад
Родитель
Сommit
86769eedea

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

@@ -263,6 +263,17 @@ public class Bridge {
         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
      * the schema.