mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-24 15:54:48 +00:00
Restore streaming API output format (#4100)
* Restore streaming API output format Regression from #4090 * Remove whitespace
This commit is contained in:
parent
6e1261f277
commit
ebd2dde688
|
@ -262,11 +262,12 @@ const startWorker = (workerId) => {
|
||||||
const { event, payload, queued_at } = JSON.parse(message);
|
const { event, payload, queued_at } = JSON.parse(message);
|
||||||
|
|
||||||
const transmit = () => {
|
const transmit = () => {
|
||||||
const now = new Date().getTime();
|
const now = new Date().getTime();
|
||||||
const delta = now - queued_at;
|
const delta = now - queued_at;
|
||||||
|
const encodedPayload = typeof payload === 'number' ? payload : JSON.stringify(payload);
|
||||||
|
|
||||||
log.silly(req.requestId, `Transmitting for ${req.accountId}: ${event} ${payload} Delay: ${delta}ms`);
|
log.silly(req.requestId, `Transmitting for ${req.accountId}: ${event} ${encodedPayload} Delay: ${delta}ms`);
|
||||||
output(event, payload);
|
output(event, encodedPayload);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (notificationOnly && event !== 'notification') {
|
if (notificationOnly && event !== 'notification') {
|
||||||
|
@ -282,7 +283,7 @@ const startWorker = (workerId) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unpackedPayload = JSON.parse(payload);
|
const unpackedPayload = payload;
|
||||||
const targetAccountIds = [unpackedPayload.account.id].concat(unpackedPayload.mentions.map(item => item.id));
|
const targetAccountIds = [unpackedPayload.account.id].concat(unpackedPayload.mentions.map(item => item.id));
|
||||||
const accountDomain = unpackedPayload.account.acct.split('@')[1];
|
const accountDomain = unpackedPayload.account.acct.split('@')[1];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue