sync: Don't pull repo when doing synchronization. Do it only on auto-sync

This commit is contained in:
nemunaire 2023-05-06 02:27:46 +02:00
parent ac64db277a
commit 5fb85c22dc
5 changed files with 17 additions and 16 deletions

View file

@ -205,6 +205,14 @@ func declareSyncExercicesRoutes(router *gin.RouterGroup) {
func autoSync(c *gin.Context) {
p := strings.Split(strings.TrimPrefix(c.Params.ByName("p"), "/"), "/")
if !IsProductionEnv {
if err := sync.GlobalImporter.Sync(); err != nil {
log.Println("Unable to sync.GI.Sync:", err.Error())
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "Unable to perform the pull."})
return
}
}
themes, err := fic.GetThemes()
if err != nil {
log.Println("Unable to GetThemes:", err.Error())