user.settings: force jsonb conversion

This commit is contained in:
Luna 2018-12-06 01:25:39 -03:00
parent b7028d4a7d
commit bcd846d779
2 changed files with 6 additions and 2 deletions

View File

@ -31,13 +31,17 @@ async def patch_current_settings():
for key in j: for key in j:
val = j[key] val = j[key]
jsonb_cnv = ''
# force postgres to update to jsonb
# when the fields ARE jsonb.
if key in json_fields: if key in json_fields:
val = json.dumps(val) val = json.dumps(val)
jsonb_cnv = '::jsonb'
await app.db.execute(f""" await app.db.execute(f"""
UPDATE user_settings UPDATE user_settings
SET {key}=$1 SET {key}=$1{jsonb_cnv}
WHERE id = $2 WHERE id = $2
""", val, user_id) """, val, user_id)

View File

@ -131,7 +131,7 @@ class GatewayWebsocket:
if len(encoded) < 2048: if len(encoded) < 2048:
log.debug('sending\n{}', pprint.pformat(payload)) log.debug('sending\n{}', pprint.pformat(payload))
else: else:
# log.debug('sending {}', pprint.pformat(payload)) log.debug('sending {}', pprint.pformat(payload))
log.debug('sending op={} s={} t={} (too big)', log.debug('sending op={} s={} t={} (too big)',
payload.get('op'), payload.get('op'),
payload.get('s'), payload.get('s'),