Skip to content

Commit

Permalink
Merge pull request tdlib#62 from davidgfnet/master
Browse files Browse the repository at this point in the history
Add knob to control the file expiration timeout.
  • Loading branch information
cavallium authored Jul 3, 2021
2 parents 538bf45 + aa118f7 commit 1c8ab81
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ if [ -n "$TELEGRAM_RELATIVE" ]; then
CUSTOM_ARGS="${CUSTOM_ARGS} --relative"
fi
if [ -n "$TELEGRAM_MAX_BATCH" ]; then
CUSTOM_ARGS="${CUSTOM_ARGS} ---max-batch-operations=$TELEGRAM_MAX_BATCH"
CUSTOM_ARGS="${CUSTOM_ARGS} --max-batch-operations=$TELEGRAM_MAX_BATCH"
fi
if [ -n "$TELEGRAM_FILE_EXPIRATION_TIME" ]; then
CUSTOM_ARGS="${CUSTOM_ARGS} --file-expiration-time=$TELEGRAM_FILE_EXPIRATION_TIME"
fi
if [ -n "$TELEGRAM_LOGS" ]; then
CUSTOM_ARGS="$CUSTOM_ARGS --log=${TELEGRAM_LOGS}"
Expand Down
3 changes: 2 additions & 1 deletion telegram-bot-api/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4581,7 +4581,8 @@ void Client::on_update_authorization_state() {
make_object<td_api::optionValueInteger>(3600)),
std::make_unique<TdOnOkCallback>());
send_request(make_object<td_api::setOption>("delete_file_reference_after_seconds",
make_object<td_api::optionValueInteger>(3600)),
make_object<td_api::optionValueInteger>(
parameters_->file_expiration_timeout_seconds_)),
std::make_unique<TdOnOkCallback>());

auto parameters = make_object<td_api::tdlibParameters>();
Expand Down
1 change: 1 addition & 0 deletions telegram-bot-api/ClientParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct ClientParameters {

td::uint32 max_batch_operations = 10000;
double start_time_ = 0;
td::int32 file_expiration_timeout_seconds_ = 3600;

td::ActorId<td::GetHostByNameActor> get_host_by_name_actor_id_;

Expand Down
3 changes: 3 additions & 0 deletions telegram-bot-api/telegram-bot-api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ int main(int argc, char *argv[]) {

options.add_checked_option('\0', "max-batch-operations", PSLICE() << "maximum number of batch operations (default: " << parameters->max_batch_operations << ")",
td::OptionParser::parse_integer(parameters->max_batch_operations));
options.add_checked_option('\0', "file-expiration-time",
PSLICE() << "downloaded files expire after this amount of seconds of not being used (defaults to " << parameters->file_expiration_timeout_seconds_ << ")",
td::OptionParser::parse_integer(parameters->file_expiration_timeout_seconds_));

options.add_checked_option(
'\0', "proxy", PSLICE() << "HTTP proxy server for outgoing webhook requests in the format http://host:port",
Expand Down

0 comments on commit 1c8ab81

Please sign in to comment.