Use ujson instead of json for parsing messages
ujson is simply faster than json :) Change-Id: I1f33dda01cc4ee09f0bae1c2d2a33fbda65c1cac
This commit is contained in:
parent
5f168778c6
commit
16d8e69a4c
@ -12,7 +12,7 @@
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import json
|
||||
import ujson as json
|
||||
|
||||
from cassandra import query
|
||||
from oslo_log import log
|
||||
|
@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import hashlib
|
||||
import json
|
||||
import ujson as json
|
||||
|
||||
from cassandra import query
|
||||
from oslo_log import log
|
||||
|
@ -12,7 +12,7 @@
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import json
|
||||
import ujson as json
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
|
@ -28,12 +28,17 @@ def escape_tag(tag):
|
||||
u"=", u"\\="
|
||||
)
|
||||
|
||||
|
||||
def get_unicode(data):
|
||||
if PY2:
|
||||
return unicode(data)
|
||||
if isinstance(data, unicode):
|
||||
return data
|
||||
else:
|
||||
return data.decode('utf-8')
|
||||
else:
|
||||
return str(data)
|
||||
|
||||
|
||||
def escape_value(value):
|
||||
return u"\"{0}\"".format(
|
||||
get_unicode(value).replace(
|
||||
|
@ -12,7 +12,7 @@
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import json
|
||||
import ujson as json
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import json
|
||||
import ujson as json
|
||||
|
||||
|
||||
def parse_measurement_message(message):
|
||||
|
Loading…
Reference in New Issue
Block a user