func quote_updater(info gofighter.TradingInfo) { for { localquote, err := gofighter.GetQuote(info) // this takes ages so can't lock before doing it if err != nil { time.Sleep(500 * time.Millisecond) continue } Quote_MUTEX.Lock() UnsafeQuote = localquote Quote_MUTEX.Unlock() time.Sleep(500 * time.Millisecond) } }
func quote(args []string) { result, err := gofighter.GetQuote(info) print_error_or_json(result, err) }