Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
9bce7663
Commit
9bce7663
authored
Jan 27, 2014
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Report findings of possible github zipfile caching in a comment, improve a Sprintf() setup.
parent
e07b4cbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
7 deletions
+50
-7
github_plugin.cpp
pcbnew/github/github_plugin.cpp
+49
-6
github_plugin.h
pcbnew/github/github_plugin.h
+1
-1
No files found.
pcbnew/github/github_plugin.cpp
View file @
9bce7663
...
...
@@ -24,6 +24,45 @@
/*
While exploring the possibility of local caching of the zip file, I discovered
this command to retrieve the time stamp of the last commit into any particular
repo:
$time curl -I -i https://api.github.com/repos/KiCad/Mounting_Holes.pretty
This gets just the header to what would otherwise return information on the repo
in JSON format, and is reasonably faster than actually getting the repo
in zip form. However it still takes 5 seconds or more when github is busy, so
I have lost my enthusiasm for local caching until a faster time stamp retrieval
mechanism can be found, or github gets more servers. But note that the occasionally
slow response is the exception rather than the norm. Normally the response is
down around a 1/3 of a second. The information we would use is in the header
named "Last-Modified" as seen below. This would need parsing, but avhttp may
offer some help there, if not, then boost async probably does.
HTTP/1.1 200 OK
Server: GitHub.com
Date: Mon, 27 Jan 2014 15:46:46 GMT
Content-Type: application/json; charset=utf-8
Status: 200 OK
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 49
X-RateLimit-Reset: 1390839612
Cache-Control: public, max-age=60, s-maxage=60
Last-Modified: Mon, 02 Dec 2013 10:08:51 GMT
ETag: "3d04d760f469f2516a51a56eac63bbd5"
Vary: Accept
X-GitHub-Media-Type: github.beta
X-Content-Type-Options: nosniff
Content-Length: 6310
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
X-GitHub-Request-Id: 411087C2:659E:50FD6E6:52E67F66
Vary: Accept-Encoding
*/
...
...
@@ -493,13 +532,17 @@ void GITHUB_PLUGIN::remote_get_zip( const wxString& aRepoURL ) throw( IO_ERROR )
catch
(
boost
::
system
::
system_error
&
e
)
{
// https "GET" has faild, report this to API caller.
wxString
errorcmd
(
wxT
(
"https GET command failed"
)
);
// Do not translate this message
wxString
fmt
(
_
(
"%s
\n
Cannot get/download Zip archive: '%s'
\n
for library path: '%s'.
\n
Reason: '%s'"
)
);
static
const
char
errorcmd
[]
=
"https GET command failed"
;
// Do not translate this message
UTF8
fmt
(
_
(
"%s
\n
Cannot get/download Zip archive: '%s'
\n
for library path: '%s'.
\n
Reason: '%s'"
)
);
string
msg
=
StrPrintf
(
TO_UTF8
(
fmt
),
TO_UTF8
(
errorcmd
),
zip_url
.
c_str
(),
TO_UTF8
(
aRepoURL
),
string
msg
=
StrPrintf
(
fmt
.
c_str
(),
errorcmd
,
// Report both secret zip_url and Lib Path, to user. The secret
// zip_url may go bad at some point in future if github changes
// their server architecture. Then fix repoURL_zipURL() to reflect
// new architecture.
zip_url
.
c_str
(),
TO_UTF8
(
aRepoURL
),
e
.
what
()
);
THROW_IO_ERROR
(
msg
);
...
...
pcbnew/github/github_plugin.h
View file @
9bce7663
...
...
@@ -39,7 +39,7 @@ struct GH_CACHE;
<p>It could have used version 3 of the github.com API documented here:
<pre>
http://developer.github.com
http://developer.github.com
/v3/
https://help.github.com/articles/creating-an-access-token-for-command-line-use
</pre>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment