Replace post_timed with post_delayed
This commit is contained in:
parent
5bc6a64eed
commit
f53f1f8d98
13 changed files with 56 additions and 48 deletions
|
|
@ -39,7 +39,7 @@ TEST (thread_pool, one)
|
|||
nano::condition_variable condition;
|
||||
nano::thread_pool workers (1u, nano::thread_role::name::unknown);
|
||||
nano::test::start_stop_guard stop_guard{ workers };
|
||||
workers.post_timed (std::chrono::steady_clock::now (), [&] () {
|
||||
workers.post ([&] () {
|
||||
{
|
||||
nano::lock_guard<nano::mutex> lock{ mutex };
|
||||
done = true;
|
||||
|
|
@ -59,7 +59,7 @@ TEST (thread_pool, many)
|
|||
nano::test::start_stop_guard stop_guard{ workers };
|
||||
for (auto i (0); i < 50; ++i)
|
||||
{
|
||||
workers.post_timed (std::chrono::steady_clock::now (), [&] () {
|
||||
workers.post ([&] () {
|
||||
{
|
||||
nano::lock_guard<nano::mutex> lock{ mutex };
|
||||
count += 1;
|
||||
|
|
@ -79,12 +79,12 @@ TEST (thread_pool, top_execution)
|
|||
std::promise<bool> promise;
|
||||
nano::thread_pool workers (1u, nano::thread_role::name::unknown);
|
||||
nano::test::start_stop_guard stop_guard{ workers };
|
||||
workers.post_timed (std::chrono::steady_clock::now (), [&] () {
|
||||
workers.post ([&] () {
|
||||
nano::lock_guard<nano::mutex> lock{ mutex };
|
||||
value1 = 1;
|
||||
value2 = 1;
|
||||
});
|
||||
workers.post_timed (std::chrono::steady_clock::now () + std::chrono::milliseconds (1), [&] () {
|
||||
workers.post_delayed (std::chrono::milliseconds (1), [&] () {
|
||||
nano::lock_guard<nano::mutex> lock{ mutex };
|
||||
value2 = 2;
|
||||
promise.set_value (false);
|
||||
|
|
|
|||
|
|
@ -84,17 +84,19 @@ public:
|
|||
}
|
||||
|
||||
template <typename F>
|
||||
void post_timed (std::chrono::steady_clock::time_point const & expiry_time, F && task)
|
||||
void post_delayed (std::chrono::steady_clock::duration const & delay, F && task)
|
||||
{
|
||||
nano::lock_guard<nano::mutex> guard{ mutex };
|
||||
if (!stopped)
|
||||
{
|
||||
++num_delayed;
|
||||
release_assert (thread_pool_impl);
|
||||
auto timer = std::make_shared<boost::asio::steady_timer> (thread_pool_impl->get_executor ());
|
||||
timer->expires_at (expiry_time);
|
||||
timer->expires_after (delay);
|
||||
timer->async_wait ([this, t = std::forward<F> (task), /* preserve lifetime */ timer] (boost::system::error_code const & ec) mutable {
|
||||
if (!ec)
|
||||
{
|
||||
--num_delayed;
|
||||
post (std::move (t));
|
||||
}
|
||||
});
|
||||
|
|
@ -112,10 +114,16 @@ public:
|
|||
return num_tasks;
|
||||
}
|
||||
|
||||
uint64_t delayed_tasks () const
|
||||
{
|
||||
return num_delayed;
|
||||
}
|
||||
|
||||
nano::container_info container_info () const
|
||||
{
|
||||
nano::container_info info;
|
||||
info.put ("tasks", queued_tasks ());
|
||||
info.put ("tasks", num_tasks);
|
||||
info.put ("delayed", num_delayed);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
@ -141,5 +149,6 @@ private:
|
|||
std::atomic<bool> stopped{ false };
|
||||
std::unique_ptr<boost::asio::thread_pool> thread_pool_impl;
|
||||
std::atomic<uint64_t> num_tasks{ 0 };
|
||||
std::atomic<uint64_t> num_delayed{ 0 };
|
||||
};
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ void nano::bulk_pull_client::throttled_receive_block ()
|
|||
else
|
||||
{
|
||||
auto this_l (shared_from_this ());
|
||||
node->workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (1), [this_l] () {
|
||||
node->workers.post_delayed (std::chrono::seconds (1), [this_l] () {
|
||||
if (!this_l->connection->pending_stop && !this_l->attempt->stopped)
|
||||
{
|
||||
this_l->throttled_receive_block ();
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ void nano::bulk_push_server::throttled_receive ()
|
|||
else
|
||||
{
|
||||
auto this_l (shared_from_this ());
|
||||
node->workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (1), [this_l] () {
|
||||
node->workers.post_delayed (std::chrono::seconds (1), [this_l] () {
|
||||
if (!this_l->connection->stopped)
|
||||
{
|
||||
this_l->throttled_receive ();
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ void nano::bootstrap_connections::populate_connections (bool repeat)
|
|||
if (!stopped && repeat)
|
||||
{
|
||||
std::weak_ptr<nano::bootstrap_connections> this_w (shared_from_this ());
|
||||
node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (1), [this_w] () {
|
||||
node.workers.post_delayed (std::chrono::seconds (1), [this_w] () {
|
||||
if (auto this_l = this_w.lock ())
|
||||
{
|
||||
this_l->populate_connections ();
|
||||
|
|
|
|||
|
|
@ -400,10 +400,9 @@ void nano::distributed_work::handle_failure ()
|
|||
|
||||
status = work_generation_status::failure_peers;
|
||||
|
||||
auto now (std::chrono::steady_clock::now ());
|
||||
std::weak_ptr<nano::node> node_weak (node.shared ());
|
||||
auto next_backoff (std::min (backoff * 2, std::chrono::seconds (5 * 60)));
|
||||
node.workers.post_timed (now + std::chrono::seconds (backoff), [node_weak, request_l = request, next_backoff] {
|
||||
node.workers.post_delayed (std::chrono::seconds (backoff), [node_weak, request_l = request, next_backoff] {
|
||||
bool error_l{ true };
|
||||
if (auto node_l = node_weak.lock ())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ void nano::network::flood_block_many (std::deque<std::shared_ptr<nano::block>> b
|
|||
if (!blocks_a.empty ())
|
||||
{
|
||||
std::weak_ptr<nano::node> node_w (node.shared ());
|
||||
node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::milliseconds (delay_a + std::rand () % delay_a), [node_w, blocks (std::move (blocks_a)), callback_a, delay_a] () {
|
||||
node.workers.post_delayed (std::chrono::milliseconds (delay_a + std::rand () % delay_a), [node_w, blocks (std::move (blocks_a)), callback_a, delay_a] () {
|
||||
if (auto node_l = node_w.lock ())
|
||||
{
|
||||
node_l->network.flood_block_many (std::move (blocks), callback_a, delay_a);
|
||||
|
|
|
|||
|
|
@ -609,7 +609,7 @@ void nano::node::start ()
|
|||
{
|
||||
// Delay to start wallet lazy bootstrap
|
||||
auto this_l (shared ());
|
||||
workers.post_timed (std::chrono::steady_clock::now () + std::chrono::minutes (1), [this_l] () {
|
||||
workers.post_delayed (std::chrono::minutes (1), [this_l] () {
|
||||
this_l->bootstrap_wallet ();
|
||||
});
|
||||
}
|
||||
|
|
@ -829,7 +829,7 @@ void nano::node::ongoing_bootstrap ()
|
|||
// Bootstrap and schedule for next attempt
|
||||
bootstrap_initiator.bootstrap (false, boost::str (boost::format ("auto_bootstrap_%1%") % previous_bootstrap_count), frontiers_age);
|
||||
std::weak_ptr<nano::node> node_w (shared_from_this ());
|
||||
workers.post_timed (std::chrono::steady_clock::now () + next_wakeup, [node_w] () {
|
||||
workers.post_delayed (next_wakeup, [node_w] () {
|
||||
if (auto node_l = node_w.lock ())
|
||||
{
|
||||
node_l->ongoing_bootstrap ();
|
||||
|
|
@ -850,7 +850,7 @@ void nano::node::backup_wallet ()
|
|||
i->second->store.write_backup (transaction, backup_path / (i->first.to_string () + ".json"));
|
||||
}
|
||||
auto this_l (shared ());
|
||||
workers.post_timed (std::chrono::steady_clock::now () + network_params.node.backup_interval, [this_l] () {
|
||||
workers.post_delayed (network_params.node.backup_interval, [this_l] () {
|
||||
this_l->backup_wallet ();
|
||||
});
|
||||
}
|
||||
|
|
@ -862,7 +862,7 @@ void nano::node::search_receivable_all ()
|
|||
// Search pending
|
||||
wallets.search_receivable_all ();
|
||||
auto this_l (shared ());
|
||||
workers.post_timed (std::chrono::steady_clock::now () + network_params.node.search_pending_interval, [this_l] () {
|
||||
workers.post_delayed (network_params.node.search_pending_interval, [this_l] () {
|
||||
this_l->search_receivable_all ();
|
||||
});
|
||||
}
|
||||
|
|
@ -987,7 +987,7 @@ void nano::node::ongoing_ledger_pruning ()
|
|||
ledger_pruning (flags.block_processor_batch_size != 0 ? flags.block_processor_batch_size : 2 * 1024, bootstrap_weight_reached);
|
||||
auto const ledger_pruning_interval (bootstrap_weight_reached ? config.max_pruning_age : std::min (config.max_pruning_age, std::chrono::seconds (15 * 60)));
|
||||
auto this_l (shared ());
|
||||
workers.post_timed (std::chrono::steady_clock::now () + ledger_pruning_interval, [this_l] () {
|
||||
workers.post_delayed (ledger_pruning_interval, [this_l] () {
|
||||
this_l->workers.post ([this_l] () {
|
||||
this_l->ongoing_ledger_pruning ();
|
||||
});
|
||||
|
|
@ -1132,7 +1132,7 @@ bool nano::node::block_confirmed_or_being_confirmed (nano::block_hash const & ha
|
|||
void nano::node::ongoing_online_weight_calculation_queue ()
|
||||
{
|
||||
std::weak_ptr<nano::node> node_w (shared_from_this ());
|
||||
workers.post_timed (std::chrono::steady_clock::now () + (std::chrono::seconds (network_params.node.weight_period)), [node_w] () {
|
||||
workers.post_delayed ((std::chrono::seconds (network_params.node.weight_period)), [node_w] () {
|
||||
if (auto node_l = node_w.lock ())
|
||||
{
|
||||
node_l->ongoing_online_weight_calculation ();
|
||||
|
|
@ -1171,7 +1171,7 @@ void nano::node::process_confirmed (nano::block_hash hash, std::shared_ptr<nano:
|
|||
stats.inc (nano::stat::type::process_confirmed, nano::stat::detail::retry);
|
||||
|
||||
// Try again later
|
||||
election_workers.post_timed (std::chrono::steady_clock::now () + network_params.node.process_confirmed_interval, [this, hash, election, iteration] () {
|
||||
election_workers.post_delayed (network_params.node.process_confirmed_interval, [this, hash, election, iteration] () {
|
||||
process_confirmed (hash, election, iteration + 1);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ void nano::transport::tcp_socket::ongoing_checkup ()
|
|||
return;
|
||||
}
|
||||
|
||||
node_l->workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (node_l->network_params.network.is_dev_network () ? 1 : 5), [this_w = weak_from_this ()] () {
|
||||
node_l->workers.post_delayed (std::chrono::seconds (node_l->network_params.network.is_dev_network () ? 1 : 5), [this_w = weak_from_this ()] () {
|
||||
auto this_l = this_w.lock ();
|
||||
if (!this_l)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1158,7 +1158,7 @@ void nano::wallet::work_ensure (nano::account const & account_a, nano::root cons
|
|||
|
||||
wallets.delayed_work->operator[] (account_a) = root_a;
|
||||
|
||||
wallets.node.workers.post_timed (std::chrono::steady_clock::now () + precache_delay, [this_l = shared_from_this (), account_a, root_a] {
|
||||
wallets.node.workers.post_delayed (precache_delay, [this_l = shared_from_this (), account_a, root_a] {
|
||||
auto delayed_work = this_l->wallets.delayed_work.lock ();
|
||||
auto existing (delayed_work->find (account_a));
|
||||
if (existing != delayed_work->end () && existing->second == root_a)
|
||||
|
|
@ -1705,7 +1705,7 @@ void nano::wallets::ongoing_compute_reps ()
|
|||
auto & node_l (node);
|
||||
// Representation drifts quickly on the test network but very slowly on the live network
|
||||
auto compute_delay = network_params.network.is_dev_network () ? std::chrono::milliseconds (10) : (network_params.network.is_test_network () ? std::chrono::milliseconds (nano::test_scan_wallet_reps_delay ()) : std::chrono::minutes (15));
|
||||
node.workers.post_timed (std::chrono::steady_clock::now () + compute_delay, [&node_l] () {
|
||||
node.workers.post_delayed (compute_delay, [&node_l] () {
|
||||
node_l.wallets.ongoing_compute_reps ();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ nano_qt::self_pane::self_pane (nano_qt::wallet & wallet_a, nano::account const &
|
|||
QObject::connect (copy_button, &QPushButton::clicked, [this] () {
|
||||
this->wallet.application.clipboard ()->setText (QString (this->wallet.account.to_account ().c_str ()));
|
||||
copy_button->setText ("Copied!");
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (2), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (2), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
copy_button->setText ("Copy");
|
||||
}));
|
||||
|
|
@ -201,7 +201,7 @@ nano_qt::accounts::accounts (nano_qt::wallet & wallet_a) :
|
|||
this->wallet.wallet_m->deterministic_insert (transaction);
|
||||
show_button_success (*create_account);
|
||||
create_account->setText ("New account was created");
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_button_ok (*create_account);
|
||||
create_account->setText ("Create account");
|
||||
|
|
@ -212,7 +212,7 @@ nano_qt::accounts::accounts (nano_qt::wallet & wallet_a) :
|
|||
{
|
||||
show_button_error (*create_account);
|
||||
create_account->setText ("Wallet is locked, unlock it to create account");
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_button_ok (*create_account);
|
||||
create_account->setText ("Create account");
|
||||
|
|
@ -234,7 +234,7 @@ nano_qt::accounts::accounts (nano_qt::wallet & wallet_a) :
|
|||
this->wallet.application.clipboard ()->setText (QString (seed.to_string ().c_str ()));
|
||||
show_button_success (*backup_seed);
|
||||
backup_seed->setText ("Seed was copied to clipboard");
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_button_ok (*backup_seed);
|
||||
backup_seed->setText ("Copy wallet seed to clipboard");
|
||||
|
|
@ -246,7 +246,7 @@ nano_qt::accounts::accounts (nano_qt::wallet & wallet_a) :
|
|||
this->wallet.application.clipboard ()->setText ("");
|
||||
show_button_error (*backup_seed);
|
||||
backup_seed->setText ("Wallet is locked, unlock it to enable the backup");
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_button_ok (*backup_seed);
|
||||
backup_seed->setText ("Copy wallet seed to clipboard");
|
||||
|
|
@ -280,7 +280,7 @@ void nano_qt::accounts::refresh_wallet_balance ()
|
|||
final_text += "\nReady to receive: " + wallet.format_balance (pending);
|
||||
}
|
||||
wallet_balance_label->setText (QString (final_text.c_str ()));
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (60), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (60), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
refresh_wallet_balance ();
|
||||
}));
|
||||
|
|
@ -410,7 +410,7 @@ nano_qt::import::import (nano_qt::wallet & wallet_a) :
|
|||
show_line_error (*seed);
|
||||
show_button_error (*import_seed);
|
||||
import_seed->setText ("Wallet is locked, unlock it to enable the import");
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (10), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (10), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_line_ok (*seed);
|
||||
show_button_ok (*import_seed);
|
||||
|
|
@ -427,7 +427,7 @@ nano_qt::import::import (nano_qt::wallet & wallet_a) :
|
|||
show_button_success (*import_seed);
|
||||
import_seed->setText ("Successful import of seed");
|
||||
this->wallet.refresh ();
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_button_ok (*import_seed);
|
||||
import_seed->setText ("Import seed");
|
||||
|
|
@ -447,7 +447,7 @@ nano_qt::import::import (nano_qt::wallet & wallet_a) :
|
|||
{
|
||||
import_seed->setText ("Incorrect seed. Only HEX characters allowed");
|
||||
}
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_button_ok (*import_seed);
|
||||
import_seed->setText ("Import seed");
|
||||
|
|
@ -460,7 +460,7 @@ nano_qt::import::import (nano_qt::wallet & wallet_a) :
|
|||
show_line_error (*clear_line);
|
||||
show_button_error (*import_seed);
|
||||
import_seed->setText ("Type words 'clear keys'");
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_button_ok (*import_seed);
|
||||
import_seed->setText ("Import seed");
|
||||
|
|
@ -745,7 +745,7 @@ void nano_qt::block_viewer::rebroadcast_action (nano::block_hash const & hash_a)
|
|||
if (successor)
|
||||
{
|
||||
done = false;
|
||||
wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (1), [this, successor] () {
|
||||
wallet.node.workers.post_delayed (std::chrono::seconds (1), [this, successor] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this, successor] () {
|
||||
rebroadcast_action (successor.value ());
|
||||
}));
|
||||
|
|
@ -1147,7 +1147,7 @@ void nano_qt::wallet::ongoing_refresh ()
|
|||
}
|
||||
}));
|
||||
|
||||
node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [wallet_w] () {
|
||||
node.workers.post_delayed (std::chrono::seconds (5), [wallet_w] () {
|
||||
if (auto wallet_l = wallet_w.lock ())
|
||||
{
|
||||
wallet_l->ongoing_refresh ();
|
||||
|
|
@ -1231,7 +1231,7 @@ void nano_qt::wallet::start ()
|
|||
{
|
||||
show_button_error (*this_l->send_blocks_send);
|
||||
this_l->send_blocks_send->setText ("Wallet is locked, unlock it to send");
|
||||
this_l->node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this_w] () {
|
||||
this_l->node.workers.post_delayed (std::chrono::seconds (5), [this_w] () {
|
||||
if (auto this_l = this_w.lock ())
|
||||
{
|
||||
this_l->application.postEvent (&this_l->processor, new eventloop_event ([this_w] () {
|
||||
|
|
@ -1250,7 +1250,7 @@ void nano_qt::wallet::start ()
|
|||
show_line_error (*this_l->send_count);
|
||||
show_button_error (*this_l->send_blocks_send);
|
||||
this_l->send_blocks_send->setText ("Not enough balance");
|
||||
this_l->node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this_w] () {
|
||||
this_l->node.workers.post_delayed (std::chrono::seconds (5), [this_w] () {
|
||||
if (auto this_l = this_w.lock ())
|
||||
{
|
||||
this_l->application.postEvent (&this_l->processor, new eventloop_event ([this_w] () {
|
||||
|
|
@ -1269,7 +1269,7 @@ void nano_qt::wallet::start ()
|
|||
show_line_error (*this_l->send_account);
|
||||
show_button_error (*this_l->send_blocks_send);
|
||||
this_l->send_blocks_send->setText ("Bad destination account");
|
||||
this_l->node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this_w] () {
|
||||
this_l->node.workers.post_delayed (std::chrono::seconds (5), [this_w] () {
|
||||
if (auto this_l = this_w.lock ())
|
||||
{
|
||||
this_l->application.postEvent (&this_l->processor, new eventloop_event ([this_w] () {
|
||||
|
|
@ -1288,7 +1288,7 @@ void nano_qt::wallet::start ()
|
|||
show_line_error (*this_l->send_count);
|
||||
show_button_error (*this_l->send_blocks_send);
|
||||
this_l->send_blocks_send->setText ("Bad amount number");
|
||||
this_l->node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this_w] () {
|
||||
this_l->node.workers.post_delayed (std::chrono::seconds (5), [this_w] () {
|
||||
if (auto this_l = this_w.lock ())
|
||||
{
|
||||
this_l->application.postEvent (&this_l->processor, new eventloop_event ([this_w] () {
|
||||
|
|
@ -1464,7 +1464,7 @@ void nano_qt::wallet::update_connected ()
|
|||
|
||||
void nano_qt::wallet::empty_password ()
|
||||
{
|
||||
this->node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (3), [this] () {
|
||||
this->node.workers.post_delayed (std::chrono::seconds (3), [this] () {
|
||||
auto transaction (wallet_m->wallets.tx_begin_write ());
|
||||
wallet_m->enter_password (transaction, std::string (""));
|
||||
});
|
||||
|
|
@ -1568,7 +1568,7 @@ nano_qt::settings::settings (nano_qt::wallet & wallet_a) :
|
|||
change->setText ("Password was changed");
|
||||
this->wallet.node.logger.warn (nano::log::type::qt, "Wallet password changed");
|
||||
update_locked (false, false);
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_button_ok (*change);
|
||||
change->setText ("Set/Change password");
|
||||
|
|
@ -1586,7 +1586,7 @@ nano_qt::settings::settings (nano_qt::wallet & wallet_a) :
|
|||
{
|
||||
show_button_error (*change);
|
||||
change->setText ("Wallet is locked, unlock it");
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_button_ok (*change);
|
||||
change->setText ("Set/Change password");
|
||||
|
|
@ -1612,7 +1612,7 @@ nano_qt::settings::settings (nano_qt::wallet & wallet_a) :
|
|||
change_rep->setText ("Representative was changed");
|
||||
current_representative->setText (QString (representative_l.to_account ().c_str ()));
|
||||
new_representative->clear ();
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_button_ok (*change_rep);
|
||||
change_rep->setText ("Change representative");
|
||||
|
|
@ -1623,7 +1623,7 @@ nano_qt::settings::settings (nano_qt::wallet & wallet_a) :
|
|||
{
|
||||
show_button_error (*change_rep);
|
||||
change_rep->setText ("Wallet is locked, unlock it");
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_button_ok (*change_rep);
|
||||
change_rep->setText ("Change representative");
|
||||
|
|
@ -1636,7 +1636,7 @@ nano_qt::settings::settings (nano_qt::wallet & wallet_a) :
|
|||
show_line_error (*new_representative);
|
||||
show_button_error (*change_rep);
|
||||
change_rep->setText ("Invalid account");
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_line_ok (*new_representative);
|
||||
show_button_ok (*change_rep);
|
||||
|
|
@ -1676,7 +1676,7 @@ nano_qt::settings::settings (nano_qt::wallet & wallet_a) :
|
|||
show_line_error (*password);
|
||||
show_button_error (*lock_toggle);
|
||||
lock_toggle->setText ("Invalid password");
|
||||
this->wallet.node.workers.post_timed (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this] () {
|
||||
this->wallet.node.workers.post_delayed (std::chrono::seconds (5), [this] () {
|
||||
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this] () {
|
||||
show_line_ok (*password);
|
||||
show_button_ok (*lock_toggle);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ TEST (system, receive_while_synchronizing)
|
|||
node1->start ();
|
||||
system.nodes.push_back (node1);
|
||||
ASSERT_NE (nullptr, nano::test::establish_tcp (system, *node1, node->network.endpoint ()));
|
||||
node1->workers.post_timed (std::chrono::steady_clock::now () + std::chrono::milliseconds (200), ([&system, &key] () {
|
||||
node1->workers.post_delayed (std::chrono::milliseconds (200), ([&system, &key] () {
|
||||
auto hash (system.wallet (0)->send_sync (nano::dev::genesis_key.pub, key.pub, system.nodes[0]->config.receive_minimum.number ()));
|
||||
auto transaction = system.nodes[0]->ledger.tx_begin_read ();
|
||||
auto block = system.nodes[0]->ledger.any.block_get (transaction, hash);
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ public:
|
|||
if (count_l > 0)
|
||||
{
|
||||
auto this_l (shared_from_this ());
|
||||
node->workers.post_timed (std::chrono::steady_clock::now () + std::chrono::milliseconds (wait), [this_l] () { this_l->run (); });
|
||||
node->workers.post_delayed (std::chrono::milliseconds (wait), [this_l] () { this_l->run (); });
|
||||
}
|
||||
}
|
||||
std::vector<nano::account> accounts;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue