Skip to content

Commit

Permalink
Fix offline destionation check, merge branch 'fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyale committed Jan 19, 2022
2 parents 2f46aca + 90cc7d0 commit a9cdb49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions backend/destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ func CheckOfflineDestinations(nowTimeStamp int64) {
for _, app := range Apps {
for _, dest := range app.Destinations {
if dest.RouteType == models.ReverseProxyRoute && !dest.Online {
go func() {
go func(dest *models.Destination) {
conn, err := net.DialTimeout("tcp", dest.Destination, time.Second)
if err == nil {
defer conn.Close()
dest.Online = true
dest.CheckTime = nowTimeStamp
}
}()
}(dest)
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions backend/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ func InitDatabase() {

// v1.2.4 add constraint to access_stats
if !dal.ExistConstraint("access_stats", "stat_id") {
err = dal.ExecSQL(`ALTER TABLE "access_stats" ADD CONSTRAINT "stat_id" unique ("app_id","url_path","stat_date")`)
if err != nil {
//utils.DebugPrintln("InitDatabase ALTER TABLE access_stats add constraint", err)
}
_ = dal.ExecSQL(`ALTER TABLE "access_stats" ADD CONSTRAINT "stat_id" unique ("app_id","url_path","stat_date")`)
//if err != nil {
//utils.DebugPrintln("InitDatabase ALTER TABLE access_stats add constraint", err)
//}
}

if !dal.ExistColumnInTable("applications", "cache_enabled") {
Expand Down

0 comments on commit a9cdb49

Please sign in to comment.