mirror of
https://github.com/status-im/snorenotify.git
synced 2025-01-10 08:35:54 +00:00
remove crazy locking until I have a better idea
This commit is contained in:
parent
e26cbde75a
commit
56b1a0a3ae
@ -104,23 +104,8 @@ const QList<SnorePlugin::PluginTypes> &PluginContainer::types()
|
||||
return t;
|
||||
}
|
||||
|
||||
void PluginContainer::updatePluginCache(bool force)
|
||||
void PluginContainer::updatePluginCache()
|
||||
{
|
||||
QSystemSemaphore sema("cache_update", 1, QSystemSemaphore::Open);
|
||||
if(sema.acquire())
|
||||
{
|
||||
cache().sync();
|
||||
if(!force && cache().value("version").toString() == Version::revision())
|
||||
{
|
||||
sema.release();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qFatal("Failed to lock cache");
|
||||
}
|
||||
|
||||
snoreDebug( SNORE_DEBUG ) << "Updating plugin cache";
|
||||
foreach(PluginContaienrHash list, s_pluginCache)
|
||||
{
|
||||
@ -174,7 +159,6 @@ void PluginContainer::updatePluginCache(bool force)
|
||||
}
|
||||
cache().endArray();
|
||||
cache().sync();
|
||||
sema.release();
|
||||
}
|
||||
|
||||
void PluginContainer::loadPluginCache()
|
||||
@ -194,7 +178,7 @@ void PluginContainer::loadPluginCache()
|
||||
{
|
||||
snoreDebug( SNORE_WARNING ) << "Cache Corrupted" << fileName << cache().value("name").toString() << type;
|
||||
cache().endArray();
|
||||
updatePluginCache(true);
|
||||
updatePluginCache();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
private:
|
||||
static QHash<SnorePlugin::PluginTypes, PluginContaienrHash > s_pluginCache;
|
||||
|
||||
void static updatePluginCache(bool force = false);
|
||||
void static updatePluginCache();
|
||||
void static loadPluginCache();
|
||||
static const QDir &pluginDir();
|
||||
static inline const QString pluginExtention()
|
||||
|
Loading…
x
Reference in New Issue
Block a user