Restore timeouts from previous run
This is quite a big update, the new feature is that when the program starts it loads the next update time from the db if present. If so it resumes the timers from there. Maximum wait time is currently capped at 24h. TimerOroApi is not templated on methods anymore, rather on the new DBOperation enum. This is so that it has that enum value to pass it to other functions. This could've been a separate commit, but wth... Magic enum allows me to iterate over an enum's values at build time, it's useful for building the query in OriginsDB for the SELECT in the access table (see make_select_last_access_str()).
This commit is contained in:
parent
0faa8fb18f
commit
b06456e4b0
14 changed files with 276 additions and 46 deletions
|
@ -20,7 +20,7 @@
|
|||
#include "eventia/eventia.hpp"
|
||||
#include "eventia/signal.hpp"
|
||||
#include "roar11/ThreadPool.hpp"
|
||||
#include "oro/api.hpp"
|
||||
#include "oro/dboperation.hpp"
|
||||
#include <iostream>
|
||||
|
||||
namespace duck {
|
||||
|
@ -54,26 +54,26 @@ namespace {
|
|||
private:
|
||||
eve::Eventia* m_eventia;
|
||||
};
|
||||
|
||||
} //unnamed namespace
|
||||
|
||||
void test(oro::Api* api, oro::OriginsDB* db, std::size_t thread_count) {
|
||||
typedef TimerOroApi<&oro::Api::market_list> TimerShops;
|
||||
typedef TimerOroApi<&oro::Api::items_list> TimerItems;
|
||||
typedef TimerOroApi<&oro::Api::items_icons> TimerIcons;
|
||||
typedef TimerOroApi<&oro::Api::fame_list> TimerCreators;
|
||||
typedef TimerOroApi<oro::DBOperation::Shops> TimerShops;
|
||||
typedef TimerOroApi<oro::DBOperation::Items> TimerItems;
|
||||
typedef TimerOroApi<oro::DBOperation::Icons> TimerIcons;
|
||||
typedef TimerOroApi<oro::DBOperation::Creators> TimerCreators;
|
||||
|
||||
std::cout << "Running with " << thread_count << " worker threads\n";
|
||||
roar11::ThreadPool pool(thread_count);
|
||||
eve::Eventia worker;
|
||||
pool.submit(worker.event_functor());
|
||||
|
||||
|
||||
auto sig_int = worker.make_event<SignalInt>(&worker);
|
||||
|
||||
auto timer_items = worker.make_event<TimerItems>(0.5, &pool, api, db);
|
||||
auto timer_icons = worker.make_event<TimerIcons>(1.0, &pool, api, db);
|
||||
auto timer_shops = worker.make_event<TimerShops>(1.5, &pool, api, db);
|
||||
auto timer_creat = worker.make_event<TimerCreators>(2.0, &pool, api, db);
|
||||
auto timer_items = worker.make_event<TimerItems>(0.0, &pool, api, db);
|
||||
auto timer_icons = worker.make_event<TimerIcons>(5.0, &pool, api, db);
|
||||
auto timer_shops = worker.make_event<TimerShops>(10.0, &pool, api, db);
|
||||
auto timer_creat = worker.make_event<TimerCreators>(15.0, &pool, api, db);
|
||||
|
||||
worker.wait();
|
||||
#if !defined(NDEBUG)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue