replaced encoding/json with jsoniter high performance pkg

This commit is contained in:
Philipp Mieden 2019-05-21 10:59:54 +02:00
parent e64b07f6c6
commit 5e44495adc
6 changed files with 12 additions and 6 deletions

View File

@ -1,7 +1,6 @@
package client
import (
"encoding/json"
"net"
"strconv"
"sync"

View File

@ -2,7 +2,6 @@ package client
import (
"bytes"
"encoding/json"
"errors"
"io/ioutil"
"net/http"

View File

@ -1,7 +1,6 @@
package client
import (
"encoding/json"
"errors"
"fmt"
"io"
@ -11,8 +10,11 @@ import (
"github.com/foomo/contentserver/responses"
"github.com/foomo/contentserver/server"
jsoniter "github.com/json-iterator/go"
)
var json = jsoniter.ConfigCompatibleWithStandardLibrary
type serverResponse struct {
Reply interface{}
}

View File

@ -1,7 +1,6 @@
package repo
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
@ -10,8 +9,11 @@ import (
"github.com/foomo/contentserver/content"
"github.com/foomo/contentserver/log"
jsoniter "github.com/json-iterator/go"
)
var json = jsoniter.ConfigCompatibleWithStandardLibrary
func (repo *Repo) updateRoutine() {
go func() {
for newDimension := range repo.updateChannel {

View File

@ -1,7 +1,6 @@
package server
import (
"encoding/json"
"fmt"
"time"
@ -10,9 +9,12 @@ import (
"github.com/foomo/contentserver/requests"
"github.com/foomo/contentserver/responses"
"github.com/foomo/contentserver/status"
jsoniter "github.com/json-iterator/go"
"github.com/prometheus/client_golang/prometheus"
)
var json = jsoniter.ConfigCompatibleWithStandardLibrary
func handleRequest(r *repo.Repo, handler Handler, jsonBytes []byte, metrics *status.Metrics) (replyBytes []byte, err error) {
var (

View File

@ -1,13 +1,15 @@
package status
import (
"encoding/json"
"fmt"
"net/http"
"github.com/foomo/contentserver/log"
jsoniter "github.com/json-iterator/go"
)
var json = jsoniter.ConfigCompatibleWithStandardLibrary
func RunHealthzHandlerListener(address string, serviceName string) {
log.Notice(fmt.Sprintf("starting healthz handler on '%s'" + address))
log.Error(http.ListenAndServe(address, HealthzHandler(serviceName)))