mirror of
https://github.com/strukturag/nextcloud-spreed-signaling.git
synced 2025-04-17 16:52:32 +00:00
No need to include trailing newline in log messages.
This commit is contained in:
parent
9a921a6572
commit
2f4414561e
10 changed files with 45 additions and 45 deletions
|
@ -299,20 +299,20 @@ func (b *BackendClient) PerformJSONRequest(ctx context.Context, u *url.URL, requ
|
||||||
|
|
||||||
pool, err := b.getPool(u)
|
pool, err := b.getPool(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Could not get client pool for host %s: %s\n", u.Host, err)
|
log.Printf("Could not get client pool for host %s: %s", u.Host, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := pool.Get(ctx)
|
c, err := pool.Get(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Could not get client for host %s: %s\n", u.Host, err)
|
log.Printf("Could not get client for host %s: %s", u.Host, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer pool.Put(c)
|
defer pool.Put(c)
|
||||||
|
|
||||||
data, err := json.Marshal(request)
|
data, err := json.Marshal(request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Could not marshal request %+v: %s\n", request, err)
|
log.Printf("Could not marshal request %+v: %s", request, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,20 +335,20 @@ func (b *BackendClient) PerformJSONRequest(ctx context.Context, u *url.URL, requ
|
||||||
|
|
||||||
resp, err := performRequestWithRedirects(ctx, c, req, data)
|
resp, err := performRequestWithRedirects(ctx, c, req, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Could not send request %s to %s: %s\n", string(data), u.String(), err)
|
log.Printf("Could not send request %s to %s: %s", string(data), u.String(), err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
ct := resp.Header.Get("Content-Type")
|
ct := resp.Header.Get("Content-Type")
|
||||||
if !strings.HasPrefix(ct, "application/json") {
|
if !strings.HasPrefix(ct, "application/json") {
|
||||||
log.Printf("Received unsupported content-type from %s: %s (%s)\n", u.String(), ct, resp.Status)
|
log.Printf("Received unsupported content-type from %s: %s (%s)", u.String(), ct, resp.Status)
|
||||||
return fmt.Errorf("unsupported_content_type")
|
return fmt.Errorf("unsupported_content_type")
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Could not read response body from %s: %s\n", u.String(), err)
|
log.Printf("Could not read response body from %s: %s", u.String(), err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ func NewBackendConfiguration(config *goconf.ConfigFile) (*BackendConfiguration,
|
||||||
if len(hosts) > 1 {
|
if len(hosts) > 1 {
|
||||||
log.Println("WARNING: Using deprecated backend configuration. Please migrate the \"allowed\" setting to the new \"backends\" configuration.")
|
log.Println("WARNING: Using deprecated backend configuration. Please migrate the \"allowed\" setting to the new \"backends\" configuration.")
|
||||||
}
|
}
|
||||||
log.Printf("Allowed backend hostnames: %s\n", hosts)
|
log.Printf("Allowed backend hostnames: %s", hosts)
|
||||||
if sessionLimit > 0 {
|
if sessionLimit > 0 {
|
||||||
log.Printf("Allow a maximum of %d sessions", sessionLimit)
|
log.Printf("Allow a maximum of %d sessions", sessionLimit)
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ func (b *BackendServer) parseRequestBody(f func(http.ResponseWriter, *http.Reque
|
||||||
}
|
}
|
||||||
ct := r.Header.Get("Content-Type")
|
ct := r.Header.Get("Content-Type")
|
||||||
if !strings.HasPrefix(ct, "application/json") {
|
if !strings.HasPrefix(ct, "application/json") {
|
||||||
log.Printf("Received unsupported content-type: %s\n", ct)
|
log.Printf("Received unsupported content-type: %s", ct)
|
||||||
http.Error(w, "Unsupported Content-Type", http.StatusBadRequest)
|
http.Error(w, "Unsupported Content-Type", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -556,7 +556,7 @@ func (b *BackendServer) roomHandler(w http.ResponseWriter, r *http.Request, body
|
||||||
|
|
||||||
var request BackendServerRoomRequest
|
var request BackendServerRoomRequest
|
||||||
if err := json.Unmarshal(body, &request); err != nil {
|
if err := json.Unmarshal(body, &request); err != nil {
|
||||||
log.Printf("Error decoding body %s: %s\n", string(body), err)
|
log.Printf("Error decoding body %s: %s", string(body), err)
|
||||||
http.Error(w, "Could not read body", http.StatusBadRequest)
|
http.Error(w, "Could not read body", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -589,7 +589,7 @@ func (b *BackendServer) roomHandler(w http.ResponseWriter, r *http.Request, body
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error processing %s for room %s: %s\n", string(body), roomid, err)
|
log.Printf("Error processing %s for room %s: %s", string(body), roomid, err)
|
||||||
http.Error(w, "Error while processing", http.StatusInternalServerError)
|
http.Error(w, "Error while processing", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ func (s *Stats) Log() {
|
||||||
sentMessages := totalSentMessages - s.resetSentMessages
|
sentMessages := totalSentMessages - s.resetSentMessages
|
||||||
totalRecvMessages := atomic.AddUint64(&s.numRecvMessages, 0)
|
totalRecvMessages := atomic.AddUint64(&s.numRecvMessages, 0)
|
||||||
recvMessages := totalRecvMessages - s.resetRecvMessages
|
recvMessages := totalRecvMessages - s.resetRecvMessages
|
||||||
log.Printf("Stats: sent=%d (%d/sec), recv=%d (%d/sec), delta=%d\n",
|
log.Printf("Stats: sent=%d (%d/sec), recv=%d (%d/sec), delta=%d",
|
||||||
totalSentMessages, sentMessages/perSec,
|
totalSentMessages, sentMessages/perSec,
|
||||||
totalRecvMessages, recvMessages/perSec,
|
totalRecvMessages, recvMessages/perSec,
|
||||||
totalSentMessages-totalRecvMessages)
|
totalSentMessages-totalRecvMessages)
|
||||||
|
@ -207,13 +207,13 @@ func (c *SignalingClient) processMessage(message *signaling.ServerMessage) {
|
||||||
case "message":
|
case "message":
|
||||||
c.processMessageMessage(message)
|
c.processMessageMessage(message)
|
||||||
case "bye":
|
case "bye":
|
||||||
log.Printf("Received bye: %+v\n", message.Bye)
|
log.Printf("Received bye: %+v", message.Bye)
|
||||||
c.Close()
|
c.Close()
|
||||||
case "error":
|
case "error":
|
||||||
log.Printf("Received error: %+v\n", message.Error)
|
log.Printf("Received error: %+v", message.Error)
|
||||||
c.Close()
|
c.Close()
|
||||||
default:
|
default:
|
||||||
log.Printf("Unsupported message type: %+v\n", *message)
|
log.Printf("Unsupported message type: %+v", *message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ func (c *SignalingClient) processHelloMessage(message *signaling.ServerMessage)
|
||||||
c.privateSessionId = message.Hello.ResumeId
|
c.privateSessionId = message.Hello.ResumeId
|
||||||
c.publicSessionId = c.privateToPublicSessionId(c.privateSessionId)
|
c.publicSessionId = c.privateToPublicSessionId(c.privateSessionId)
|
||||||
c.userId = message.Hello.UserId
|
c.userId = message.Hello.UserId
|
||||||
log.Printf("Registered as %s (userid %s)\n", c.privateSessionId, c.userId)
|
log.Printf("Registered as %s (userid %s)", c.privateSessionId, c.userId)
|
||||||
c.ready_wg.Done()
|
c.ready_wg.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ func (c *SignalingClient) processMessageMessage(message *signaling.ServerMessage
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
duration := now.Sub(msg.Now)
|
duration := now.Sub(msg.Now)
|
||||||
if duration > messageReportDuration {
|
if duration > messageReportDuration {
|
||||||
log.Printf("Message took %s\n", duration)
|
log.Printf("Message took %s", duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ func (c *SignalingClient) readPump() {
|
||||||
websocket.CloseNormalClosure,
|
websocket.CloseNormalClosure,
|
||||||
websocket.CloseGoingAway,
|
websocket.CloseGoingAway,
|
||||||
websocket.CloseNoStatusReceived) {
|
websocket.CloseNoStatusReceived) {
|
||||||
log.Printf("Error: %v\n", err)
|
log.Printf("Error: %v", err)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ func (c *SignalingClient) readPump() {
|
||||||
|
|
||||||
var message signaling.ServerMessage
|
var message signaling.ServerMessage
|
||||||
if err := message.UnmarshalJSON(decodeBuffer.Bytes()); err != nil {
|
if err := message.UnmarshalJSON(decodeBuffer.Bytes()); err != nil {
|
||||||
log.Printf("Error: %v\n", err)
|
log.Printf("Error: %v", err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ func main() {
|
||||||
case 32:
|
case 32:
|
||||||
case 64:
|
case 64:
|
||||||
default:
|
default:
|
||||||
log.Printf("WARNING: The sessions hash key should be 32 or 64 bytes but is %d bytes\n", len(hashKey))
|
log.Printf("WARNING: The sessions hash key should be 32 or 64 bytes but is %d bytes", len(hashKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
blockKey, _ := config.GetString("sessions", "blockkey")
|
blockKey, _ := config.GetString("sessions", "blockkey")
|
||||||
|
@ -544,7 +544,7 @@ func main() {
|
||||||
|
|
||||||
cpus := runtime.NumCPU()
|
cpus := runtime.NumCPU()
|
||||||
runtime.GOMAXPROCS(cpus)
|
runtime.GOMAXPROCS(cpus)
|
||||||
log.Printf("Using a maximum of %d CPUs\n", cpus)
|
log.Printf("Using a maximum of %d CPUs", cpus)
|
||||||
|
|
||||||
interrupt := make(chan os.Signal, 1)
|
interrupt := make(chan os.Signal, 1)
|
||||||
signal.Notify(interrupt, os.Interrupt)
|
signal.Notify(interrupt, os.Interrupt)
|
||||||
|
@ -578,16 +578,16 @@ func main() {
|
||||||
urls = append(urls, u)
|
urls = append(urls, u)
|
||||||
urlstrings = append(urlstrings, u.String())
|
urlstrings = append(urlstrings, u.String())
|
||||||
}
|
}
|
||||||
log.Printf("Connecting to %s\n", urlstrings)
|
log.Printf("Connecting to %s", urlstrings)
|
||||||
|
|
||||||
clients := make([]*SignalingClient, 0)
|
clients := make([]*SignalingClient, 0)
|
||||||
stats := &Stats{}
|
stats := &Stats{}
|
||||||
|
|
||||||
if *maxClients < 2 {
|
if *maxClients < 2 {
|
||||||
log.Fatalf("Need at least 2 clients, got %d\n", *maxClients)
|
log.Fatalf("Need at least 2 clients, got %d", *maxClients)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Starting %d clients\n", *maxClients)
|
log.Printf("Starting %d clients", *maxClients)
|
||||||
|
|
||||||
var done_wg sync.WaitGroup
|
var done_wg sync.WaitGroup
|
||||||
var ready_wg sync.WaitGroup
|
var ready_wg sync.WaitGroup
|
||||||
|
|
|
@ -399,7 +399,7 @@ func (s *ClientSession) SubscribeRoomNats(n NatsClient, roomid string, roomSessi
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Printf("Session %s joined room %s with room session id %s\n", s.PublicId(), roomid, roomSessionId)
|
log.Printf("Session %s joined room %s with room session id %s", s.PublicId(), roomid, roomSessionId)
|
||||||
s.roomSessionId = roomSessionId
|
s.roomSessionId = roomSessionId
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ func (s *ClientSession) LeaveCall() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Session %s left call %s\n", s.PublicId(), room.Id())
|
log.Printf("Session %s left call %s", s.PublicId(), room.Id())
|
||||||
s.releaseMcuObjects()
|
s.releaseMcuObjects()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ func (s *ClientSession) processNatsMessage(msg *NatsMessage) *ServerMessage {
|
||||||
switch msg.Type {
|
switch msg.Type {
|
||||||
case "message":
|
case "message":
|
||||||
if msg.Message == nil {
|
if msg.Message == nil {
|
||||||
log.Printf("Received NATS message without payload: %+v\n", msg)
|
log.Printf("Received NATS message without payload: %+v", msg)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,7 +820,7 @@ func (s *ClientSession) processNatsMessage(msg *NatsMessage) *ServerMessage {
|
||||||
|
|
||||||
return msg.Message
|
return msg.Message
|
||||||
default:
|
default:
|
||||||
log.Printf("Received NATS message with unsupported type %s: %+v\n", msg.Type, msg)
|
log.Printf("Received NATS message with unsupported type %s: %+v", msg.Type, msg)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
hub.go
2
hub.go
|
@ -1289,7 +1289,7 @@ func (h *Hub) processMessageMsg(client *Client, message *ClientMessage) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Closing screen publisher for %s\n", session.PublicId())
|
log.Printf("Closing screen publisher for %s", session.PublicId())
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), h.mcuTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), h.mcuTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
publisher.Close(ctx)
|
publisher.Close(ctx)
|
||||||
|
|
22
mcu_janus.go
22
mcu_janus.go
|
@ -73,14 +73,14 @@ func convertIntValue(value interface{}) (uint64, error) {
|
||||||
switch t := value.(type) {
|
switch t := value.(type) {
|
||||||
case float64:
|
case float64:
|
||||||
if t < 0 {
|
if t < 0 {
|
||||||
return 0, fmt.Errorf("Unsupported float64 number: %+v\n", t)
|
return 0, fmt.Errorf("Unsupported float64 number: %+v", t)
|
||||||
}
|
}
|
||||||
return uint64(t), nil
|
return uint64(t), nil
|
||||||
case uint64:
|
case uint64:
|
||||||
return t, nil
|
return t, nil
|
||||||
case int64:
|
case int64:
|
||||||
if t < 0 {
|
if t < 0 {
|
||||||
return 0, fmt.Errorf("Unsupported int64 number: %+v\n", t)
|
return 0, fmt.Errorf("Unsupported int64 number: %+v", t)
|
||||||
}
|
}
|
||||||
return uint64(t), nil
|
return uint64(t), nil
|
||||||
case json.Number:
|
case json.Number:
|
||||||
|
@ -88,11 +88,11 @@ func convertIntValue(value interface{}) (uint64, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
} else if r < 0 {
|
} else if r < 0 {
|
||||||
return 0, fmt.Errorf("Unsupported JSON number: %+v\n", t)
|
return 0, fmt.Errorf("Unsupported JSON number: %+v", t)
|
||||||
}
|
}
|
||||||
return uint64(r), nil
|
return uint64(r), nil
|
||||||
default:
|
default:
|
||||||
return 0, fmt.Errorf("Unknown number type: %+v\n", t)
|
return 0, fmt.Errorf("Unknown number type: %+v", t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ func getPluginIntValue(data janus.PluginData, pluginName string, key string) uin
|
||||||
|
|
||||||
result, err := convertIntValue(val)
|
result, err := convertIntValue(val)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Invalid value %+v for %s: %s\n", val, key, err)
|
log.Printf("Invalid value %+v for %s: %s", val, key, err)
|
||||||
result = 0
|
result = 0
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
@ -267,9 +267,9 @@ func (m *mcuJanus) scheduleReconnect(err error) {
|
||||||
defer m.mu.Unlock()
|
defer m.mu.Unlock()
|
||||||
m.reconnectTimer.Reset(m.reconnectInterval)
|
m.reconnectTimer.Reset(m.reconnectInterval)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Printf("Connection to Janus gateway was interrupted, reconnecting in %s\n", m.reconnectInterval)
|
log.Printf("Connection to Janus gateway was interrupted, reconnecting in %s", m.reconnectInterval)
|
||||||
} else {
|
} else {
|
||||||
log.Printf("Reconnect to Janus gateway failed (%s), reconnecting in %s\n", err, m.reconnectInterval)
|
log.Printf("Reconnect to Janus gateway failed (%s), reconnecting in %s", err, m.reconnectInterval)
|
||||||
}
|
}
|
||||||
|
|
||||||
m.reconnectInterval = m.reconnectInterval * 2
|
m.reconnectInterval = m.reconnectInterval * 2
|
||||||
|
@ -290,11 +290,11 @@ func (m *mcuJanus) Start() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Connected to %s %s by %s\n", info.Name, info.VersionString, info.Author)
|
log.Printf("Connected to %s %s by %s", info.Name, info.VersionString, info.Author)
|
||||||
if plugin, found := info.Plugins[pluginVideoRoom]; !found {
|
if plugin, found := info.Plugins[pluginVideoRoom]; !found {
|
||||||
return fmt.Errorf("Plugin %s is not supported", pluginVideoRoom)
|
return fmt.Errorf("Plugin %s is not supported", pluginVideoRoom)
|
||||||
} else {
|
} else {
|
||||||
log.Printf("Found %s %s by %s\n", plugin.Name, plugin.VersionString, plugin.Author)
|
log.Printf("Found %s %s by %s", plugin.Name, plugin.VersionString, plugin.Author)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !info.DataChannels {
|
if !info.DataChannels {
|
||||||
|
@ -743,7 +743,7 @@ func (p *mcuJanusPublisher) NotifyReconnected() {
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
handle, session, roomId, err := p.mcu.getOrCreatePublisherHandle(ctx, p.id, p.streamType, p.bitrate)
|
handle, session, roomId, err := p.mcu.getOrCreatePublisherHandle(ctx, p.id, p.streamType, p.bitrate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Could not reconnect publisher %s: %s\n", p.id, err)
|
log.Printf("Could not reconnect publisher %s: %s", p.id, err)
|
||||||
// TODO(jojo): Retry
|
// TODO(jojo): Retry
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -949,7 +949,7 @@ func (p *mcuJanusSubscriber) NotifyReconnected() {
|
||||||
handle, pub, err := p.mcu.getOrCreateSubscriberHandle(ctx, p.publisher, p.streamType)
|
handle, pub, err := p.mcu.getOrCreateSubscriberHandle(ctx, p.publisher, p.streamType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO(jojo): Retry?
|
// TODO(jojo): Retry?
|
||||||
log.Printf("Could not reconnect subscriber for publisher %s: %s\n", p.publisher, err)
|
log.Printf("Could not reconnect subscriber for publisher %s: %s", p.publisher, err)
|
||||||
p.Close(context.Background())
|
p.Close(context.Background())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ func NewNatsClient(url string) (NatsClient, error) {
|
||||||
|
|
||||||
client.nc, err = nats.Connect(url)
|
client.nc, err = nats.Connect(url)
|
||||||
}
|
}
|
||||||
log.Printf("Connection established to %s (%s)\n", client.nc.ConnectedUrl(), client.nc.ConnectedServerId())
|
log.Printf("Connection established to %s (%s)", client.nc.ConnectedUrl(), client.nc.ConnectedServerId())
|
||||||
|
|
||||||
// All communication will be JSON based.
|
// All communication will be JSON based.
|
||||||
client.conn, _ = nats.NewEncodedConn(client.nc, nats.JSON_ENCODER)
|
client.conn, _ = nats.NewEncodedConn(client.nc, nats.JSON_ENCODER)
|
||||||
|
@ -133,7 +133,7 @@ func (c *natsClient) onDisconnected(conn *nats.Conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *natsClient) onReconnected(conn *nats.Conn) {
|
func (c *natsClient) onReconnected(conn *nats.Conn) {
|
||||||
log.Printf("NATS client reconnected to %s (%s)\n", conn.ConnectedUrl(), conn.ConnectedServerId())
|
log.Printf("NATS client reconnected to %s (%s)", conn.ConnectedUrl(), conn.ConnectedServerId())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *natsClient) Subscribe(subject string, ch chan *nats.Msg) (NatsSubscription, error) {
|
func (c *natsClient) Subscribe(subject string, ch chan *nats.Msg) (NatsSubscription, error) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ func main() {
|
||||||
|
|
||||||
cpus := runtime.NumCPU()
|
cpus := runtime.NumCPU()
|
||||||
runtime.GOMAXPROCS(cpus)
|
runtime.GOMAXPROCS(cpus)
|
||||||
log.Printf("Using a maximum of %d CPUs\n", cpus)
|
log.Printf("Using a maximum of %d CPUs", cpus)
|
||||||
|
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ func main() {
|
||||||
if err := runtimepprof.StartCPUProfile(f); err != nil {
|
if err := runtimepprof.StartCPUProfile(f); err != nil {
|
||||||
log.Fatalf("Error writing CPU profile to %s: %s", *cpuprofile, err)
|
log.Fatalf("Error writing CPU profile to %s: %s", *cpuprofile, err)
|
||||||
}
|
}
|
||||||
log.Printf("Writing CPU profile to %s ...\n", *cpuprofile)
|
log.Printf("Writing CPU profile to %s ...", *cpuprofile)
|
||||||
defer runtimepprof.StopCPUProfile()
|
defer runtimepprof.StopCPUProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
log.Printf("Writing Memory profile to %s ...\n", *memprofile)
|
log.Printf("Writing Memory profile to %s ...", *memprofile)
|
||||||
runtime.GC()
|
runtime.GC()
|
||||||
if err := runtimepprof.WriteHeapProfile(f); err != nil {
|
if err := runtimepprof.WriteHeapProfile(f); err != nil {
|
||||||
log.Printf("Error writing Memory profile to %s: %s", *memprofile, err)
|
log.Printf("Error writing Memory profile to %s: %s", *memprofile, err)
|
||||||
|
@ -139,7 +139,7 @@ func main() {
|
||||||
|
|
||||||
cpus := runtime.NumCPU()
|
cpus := runtime.NumCPU()
|
||||||
runtime.GOMAXPROCS(cpus)
|
runtime.GOMAXPROCS(cpus)
|
||||||
log.Printf("Using a maximum of %d CPUs\n", cpus)
|
log.Printf("Using a maximum of %d CPUs", cpus)
|
||||||
|
|
||||||
natsUrl, _ := config.GetString("nats", "url")
|
natsUrl, _ := config.GetString("nats", "url")
|
||||||
if natsUrl == "" {
|
if natsUrl == "" {
|
||||||
|
|
Loading…
Add table
Reference in a new issue