mirror of
https://github.com/matrix-construct/construct
synced 2025-03-16 22:41:46 +01:00
modules/federation/backfill_ids: Chunk direct to socket.
This commit is contained in:
parent
7e96e00184
commit
87f792b8eb
1 changed files with 27 additions and 25 deletions
|
@ -85,37 +85,39 @@ get__backfill_ids(client &client,
|
|||
room_id, event_id
|
||||
};
|
||||
|
||||
//TODO: chunk direct to socket
|
||||
const unique_buffer<mutable_buffer> buf
|
||||
{
|
||||
512 * limit //TODO: XXX
|
||||
4_KiB
|
||||
};
|
||||
|
||||
json::stack out{buf};
|
||||
resource::response::chunked response
|
||||
{
|
||||
json::stack::object top{out};
|
||||
json::stack::member pdus_m
|
||||
{
|
||||
top, "pdu_ids"
|
||||
};
|
||||
|
||||
json::stack::array pdus
|
||||
{
|
||||
pdus_m
|
||||
};
|
||||
|
||||
size_t count{0};
|
||||
for(; it && count < limit; ++count, --it)
|
||||
pdus.append(it.event_id());
|
||||
}
|
||||
|
||||
return resource::response
|
||||
{
|
||||
client, json::object
|
||||
{
|
||||
out.completed()
|
||||
}
|
||||
client, http::OK
|
||||
};
|
||||
|
||||
json::stack out{buf, [&response]
|
||||
(const const_buffer &buf)
|
||||
{
|
||||
response.write(buf);
|
||||
return buf;
|
||||
}};
|
||||
|
||||
json::stack::object top{out};
|
||||
json::stack::member pdus_m
|
||||
{
|
||||
top, "pdu_ids"
|
||||
};
|
||||
|
||||
json::stack::array pdus
|
||||
{
|
||||
pdus_m
|
||||
};
|
||||
|
||||
size_t count{0};
|
||||
for(; it && count < limit; ++count, --it)
|
||||
pdus.append(it.event_id());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
resource::method
|
||||
|
|
Loading…
Add table
Reference in a new issue