summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2014-01-04 20:59:40 +0000
committerrandomdan <randomdan@localhost>2014-01-04 20:59:40 +0000
commitea03f86900b1d2ccda9ce0b539ed69a6d3b27122 (patch)
tree8e1fb6a9e46cc60e5c77d5d3846bb61cd73de290
parentExplicit instantiations of instance store/map/set to avoid multiple instantia... (diff)
downloadp2pvr-ea03f86900b1d2ccda9ce0b539ed69a6d3b27122.tar.bz2
p2pvr-ea03f86900b1d2ccda9ce0b539ed69a6d3b27122.tar.xz
p2pvr-ea03f86900b1d2ccda9ce0b539ed69a6d3b27122.zip
Do reschudule automatically after events have been updated
-rw-r--r--p2pvr/.p2config2
-rw-r--r--p2pvr/lib/dbClient.cpp7
-rw-r--r--p2pvr/lib/dbClient.h3
-rw-r--r--p2pvr/lib/maintenance.cpp2
-rw-r--r--p2pvr/lib/maintenance/events.cpp5
5 files changed, 18 insertions, 1 deletions
diff --git a/p2pvr/.p2config b/p2pvr/.p2config
index 723dd2e..ddf998e 100644
--- a/p2pvr/.p2config
+++ b/p2pvr/.p2config
@@ -4,5 +4,5 @@ common.filelog.level = 9
common.filelog.path = /tmp/p2daemon.log
common.filelog.openmode = w
common.consolelogLevel = 9
-p2pvr.globaldevices.carddaemon = Devices:default -h defiant -p 10001
+p2pvr.globaldevices.carddaemon = Devices:default -h defiant -p 10000
p2pvr.storage.root = /tmp/p2pvr/recordings
diff --git a/p2pvr/lib/dbClient.cpp b/p2pvr/lib/dbClient.cpp
index c12cb6c..8267584 100644
--- a/p2pvr/lib/dbClient.cpp
+++ b/p2pvr/lib/dbClient.cpp
@@ -20,12 +20,19 @@ DatabaseClient::onAllDatasources(const DataSourceCall & call) const
}
DatabaseClient::TxHelper::TxHelper(const DatabaseClient * dbc) :
+ client(dbc),
so(NULL,
boost::bind(&DatabaseClient::onAllDatasources, dbc, DataSourceCall(boost::bind(&DataSource::commit, _1))),
boost::bind(&DatabaseClient::onAllDatasources, dbc, DataSourceCall(boost::bind(&DataSource::rollback, _1))))
{
}
+void
+DatabaseClient::TxHelper::Commit() const
+{
+ client->onAllDatasources(boost::bind(&DataSource::commit, _1));
+}
+
DatabaseClient::NoRowsFoundException::NoRowsFoundException() :
std::runtime_error("No rows found")
{
diff --git a/p2pvr/lib/dbClient.h b/p2pvr/lib/dbClient.h
index cf18669..84cf5e7 100644
--- a/p2pvr/lib/dbClient.h
+++ b/p2pvr/lib/dbClient.h
@@ -24,7 +24,10 @@ class DatabaseClient : public virtual CommonObjects {
class TxHelper {
public:
TxHelper(const DatabaseClient *);
+ void Commit() const;
+
private:
+ const DatabaseClient * client;
ScopeObject so;
};
diff --git a/p2pvr/lib/maintenance.cpp b/p2pvr/lib/maintenance.cpp
index b31998b..3475544 100644
--- a/p2pvr/lib/maintenance.cpp
+++ b/p2pvr/lib/maintenance.cpp
@@ -30,7 +30,9 @@ Maintenance::Maintenance(Ice::ObjectAdapterPtr a, IceUtil::TimerPtr t) :
updateRunning(false)
{
timer->scheduleRepeated(clientCheck, IceUtil::Time::seconds(5 * 60));
+#ifdef NDEBUG
ScheduledUpdate();
+#endif
}
void
diff --git a/p2pvr/lib/maintenance/events.cpp b/p2pvr/lib/maintenance/events.cpp
index 0327ec8..308b726 100644
--- a/p2pvr/lib/maintenance/events.cpp
+++ b/p2pvr/lib/maintenance/events.cpp
@@ -82,6 +82,11 @@ Maintenance::UpdateEvents(short type, const Ice::Current & ice)
mergeEvents.sources.insert(new SiEventsMerger(type, ice));
mergeEvents.loadComplete(this);
mergeEvents.execute(NULL);
+ tx.Commit();
Logger()->messagebf(LOG_INFO, "%s: Updated events", __PRETTY_FUNCTION__);
+
+ auto ic = ice.adapter->getCommunicator();
+ auto sch = P2PVR::SchedulesPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("Schedules")));
+ sch->DoReschedule();
}