Don't cache github libraries above nginx server.

It's too expensive to fetch the timestamps when the github
server is busy.  See Dick Hollenbeck's comments at the top of
github_plugin.cpp for more info.

Also adds some safety to the other caching algorithms after
seeing github_plugin's wild-west usage of the kicad_plugin.

Fixes: lp:1753143
* https://bugs.launchpad.net/kicad/+bug/1753143
This commit is contained in:
Jeff Young
2018-03-04 01:13:09 +00:00
parent 43147a3a7a
commit 284c346828
13 changed files with 44 additions and 18 deletions
+23
View File
@@ -464,6 +464,29 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aP
}
long long GITHUB_PLUGIN::GetLibraryTimestamp( const wxString& aLibraryPath ) const
{
// This plugin currently relies on the nginx server for caching (see comments
// at top of file).
// Since only the nginx server holds the timestamp information, we must defeat
// all caching above the nginx server.
return wxDateTime::Now().GetValue().GetValue();
#if 0
// If we have no cache, return a number which won't match any stored timestamps
if( !m_gh_cache || m_lib_path != aLibraryPath )
return wxDateTime::Now().GetValue().GetValue();
long long hash = m_gh_cache->GetTimestamp();
if( m_pretty_dir.size() )
hash += PCB_IO::GetLibraryTimestamp( m_pretty_dir );
return hash;
#endif
}
bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, std::string* aZipURL )
{
// e.g. "https://github.com/liftoff-sr/pretty_footprints"