Skip to content

Commit

Permalink
added fix for possible 503s during reload of config.
Browse files Browse the repository at this point in the history
  • Loading branch information
martensson committed Jan 15, 2016
1 parent b4f5104 commit cfc8c06
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion marathon.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ func fetchApps(jsontasks *MarathonTasks, jsonapps *MarathonApps) error {
}

func syncApps(jsontasks *MarathonTasks, jsonapps *MarathonApps) {
apps = Apps{Apps: make(map[string]App)}
apps.Lock()
defer apps.Unlock()
apps.Apps = make(map[string]App)
for _, task := range jsontasks.Tasks {
// Use regex to remove characters that are not allowed in hostnames
re := regexp.MustCompile("[^0-9a-z-]")
Expand Down
2 changes: 2 additions & 0 deletions moxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ func moxy_proxy(w http.ResponseWriter, r *http.Request) {
if config.Xproxy != "" {
w.Header().Add("X-Proxy", config.Xproxy)
}
apps.RLock()
defer apps.RUnlock()
if s, ok := apps.Apps[app]; ok {
if config.Statsd != "" {
go func(app string) {
Expand Down

0 comments on commit cfc8c06

Please sign in to comment.