0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-19 16:30:52 +01:00

modules/console: Source all timeout values from the options structure.

This commit is contained in:
Jason Volk 2018-04-07 02:01:04 -07:00
parent e7c7a295c4
commit 2770c19ac2

View file

@ -33,6 +33,7 @@ struct opt
{ {
std::ostream &out; std::ostream &out;
bool html {false}; bool html {false};
seconds timeout {30};
operator std::ostream &() operator std::ostream &()
{ {
@ -1161,7 +1162,7 @@ console_cmd__event__fetch(opt &out, const string_view &line)
event_id, buf, std::move(opts) event_id, buf, std::move(opts)
}; };
request.wait(seconds(10)); request.wait(out.timeout);
const auto code const auto code
{ {
request.get() request.get()
@ -2036,7 +2037,7 @@ console_cmd__fed__groups(opt &out, const string_view &line)
node, vector_view<const m::user::id>(ids, count), buf, std::move(opts) node, vector_view<const m::user::id>(ids, count), buf, std::move(opts)
}; };
request.wait(seconds(10)); request.wait(out.timeout);
request.get(); request.get();
const json::object response const json::object response
@ -2079,7 +2080,7 @@ console_cmd__fed__head(opt &out, const string_view &line)
room_id, m::me.user_id, buf, std::move(opts) room_id, m::me.user_id, buf, std::move(opts)
}; };
request.wait(seconds(5)); request.wait(out.timeout);
request.get(); request.get();
const json::object proto const json::object proto
@ -2158,7 +2159,7 @@ console_cmd__fed__send(opt &out, const string_view &line)
txnid, const_buffer{txn}, bufs, std::move(opts) txnid, const_buffer{txn}, bufs, std::move(opts)
}; };
request.wait(seconds(30)); request.wait(out.timeout);
const auto code const auto code
{ {
@ -2218,7 +2219,7 @@ console_cmd__fed__sync(opt &out, const string_view &line)
const auto timeout const auto timeout
{ {
param.at(4, seconds(30)) param.at(4, out.timeout)
}; };
// Used for out.head, out.content, in.head, but in.content is dynamic // Used for out.head, out.content, in.head, but in.content is dynamic
@ -2356,7 +2357,7 @@ console_cmd__fed__state(opt &out, const string_view &line)
room_id, buf, std::move(opts) room_id, buf, std::move(opts)
}; };
request.wait(seconds(30)); request.wait(out.timeout);
request.get(); request.get();
const json::object &response const json::object &response
@ -2440,7 +2441,7 @@ console_cmd__fed__state_ids(opt &out, const string_view &line)
room_id, buf, std::move(opts) room_id, buf, std::move(opts)
}; };
request.wait(seconds(30)); request.wait(out.timeout);
request.get(); request.get();
const json::object &response const json::object &response
@ -2511,7 +2512,7 @@ console_cmd__fed__backfill(opt &out, const string_view &line)
room_id, buf, std::move(opts) room_id, buf, std::move(opts)
}; };
request.wait(seconds(10)); request.wait(out.timeout);
request.get(); request.get();
const json::object &response const json::object &response
@ -2580,7 +2581,7 @@ console_cmd__fed__event(opt &out, const string_view &line)
event_id, buf, std::move(opts) event_id, buf, std::move(opts)
}; };
request.wait(seconds(10)); request.wait(out.timeout);
request.get(); request.get();
const json::object &response const json::object &response
@ -2653,7 +2654,7 @@ console_cmd__fed__query__profile(opt &out, const string_view &line)
user_id, buf, std::move(opts) user_id, buf, std::move(opts)
}; };
request.wait(seconds(10)); request.wait(out.timeout);
const auto code const auto code
{ {
request.get() request.get()
@ -2690,7 +2691,7 @@ console_cmd__fed__query__directory(opt &out, const string_view &line)
room_alias, buf, std::move(opts) room_alias, buf, std::move(opts)
}; };
request.wait(seconds(10)); request.wait(out.timeout);
const auto code const auto code
{ {
request.get() request.get()
@ -2731,7 +2732,7 @@ console_cmd__fed__user__devices(opt &out, const string_view &line)
user_id, buf, std::move(opts) user_id, buf, std::move(opts)
}; };
request.wait(seconds(15)); request.wait(out.timeout);
const auto code const auto code
{ {
request.get() request.get()
@ -2790,7 +2791,7 @@ console_cmd__fed__query__client_keys(opt &out, const string_view &line)
user_id, device_id, buf, std::move(opts) user_id, device_id, buf, std::move(opts)
}; };
request.wait(seconds(10)); request.wait(out.timeout);
const auto code const auto code
{ {
request.get() request.get()
@ -2822,7 +2823,7 @@ console_cmd__fed__version(opt &out, const string_view &line)
buf, std::move(opts) buf, std::move(opts)
}; };
request.wait(seconds(10)); request.wait(out.timeout);
const auto code const auto code
{ {
request.get() request.get()