|
|
|
@ -14,7 +14,7 @@ |
|
|
|
|
# limitations under the License. |
|
|
|
|
|
|
|
|
|
import logging |
|
|
|
|
import ujson |
|
|
|
|
import simplejson |
|
|
|
|
|
|
|
|
|
from twisted.internet import defer |
|
|
|
|
|
|
|
|
@ -85,7 +85,7 @@ class DeviceInboxStore(BackgroundUpdateStore): |
|
|
|
|
) |
|
|
|
|
rows = [] |
|
|
|
|
for destination, edu in remote_messages_by_destination.items(): |
|
|
|
|
edu_json = ujson.dumps(edu) |
|
|
|
|
edu_json = simplejson.dumps(edu) |
|
|
|
|
rows.append((destination, stream_id, now_ms, edu_json)) |
|
|
|
|
txn.executemany(sql, rows) |
|
|
|
|
|
|
|
|
@ -177,7 +177,7 @@ class DeviceInboxStore(BackgroundUpdateStore): |
|
|
|
|
" WHERE user_id = ?" |
|
|
|
|
) |
|
|
|
|
txn.execute(sql, (user_id,)) |
|
|
|
|
message_json = ujson.dumps(messages_by_device["*"]) |
|
|
|
|
message_json = simplejson.dumps(messages_by_device["*"]) |
|
|
|
|
for row in txn: |
|
|
|
|
# Add the message for all devices for this user on this |
|
|
|
|
# server. |
|
|
|
@ -199,7 +199,7 @@ class DeviceInboxStore(BackgroundUpdateStore): |
|
|
|
|
# Only insert into the local inbox if the device exists on |
|
|
|
|
# this server |
|
|
|
|
device = row[0] |
|
|
|
|
message_json = ujson.dumps(messages_by_device[device]) |
|
|
|
|
message_json = simplejson.dumps(messages_by_device[device]) |
|
|
|
|
messages_json_for_user[device] = message_json |
|
|
|
|
|
|
|
|
|
if messages_json_for_user: |
|
|
|
@ -253,7 +253,7 @@ class DeviceInboxStore(BackgroundUpdateStore): |
|
|
|
|
messages = [] |
|
|
|
|
for row in txn: |
|
|
|
|
stream_pos = row[0] |
|
|
|
|
messages.append(ujson.loads(row[1])) |
|
|
|
|
messages.append(simplejson.loads(row[1])) |
|
|
|
|
if len(messages) < limit: |
|
|
|
|
stream_pos = current_stream_id |
|
|
|
|
return (messages, stream_pos) |
|
|
|
@ -389,7 +389,7 @@ class DeviceInboxStore(BackgroundUpdateStore): |
|
|
|
|
messages = [] |
|
|
|
|
for row in txn: |
|
|
|
|
stream_pos = row[0] |
|
|
|
|
messages.append(ujson.loads(row[1])) |
|
|
|
|
messages.append(simplejson.loads(row[1])) |
|
|
|
|
if len(messages) < limit: |
|
|
|
|
stream_pos = current_stream_id |
|
|
|
|
return (messages, stream_pos) |
|
|
|
|