Skip to content

Commit

Permalink
Avoid useless DB roundtrip when querying package zip/json files.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Jul 18, 2017
1 parent c748fe6 commit 64ed9f8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions source/dubregistry/web.d
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,6 @@ class DubRegistryWebFrontend {
auto packageInfo = packinfo.info;
auto versionInfo = verinfo.info;

User user;
if (m_userman) {
try user = m_userman.getUser(User.ID.fromString(packageInfo["owner"].get!string));
catch (Exception e) {
logDebug("Failed to get owner '%s' for %s %s: %s",
packageInfo["owner"].get!string, pname, ver, e.msg);
}
}

if (ext == "zip") {
if (pname.canFind(":")) return;

Expand All @@ -195,6 +186,15 @@ class DubRegistryWebFrontend {
if (pname.canFind(":")) return;
res.writeJsonBody(_version.length ? versionInfo : packageInfo);
} else {
User user;
if (m_userman) {
try user = m_userman.getUser(User.ID.fromString(packageInfo["owner"].get!string));
catch (Exception e) {
logDebug("Failed to get owner '%s' for %s %s: %s",
packageInfo["owner"].get!string, pname, ver, e.msg);
}
}

auto gitVer = verinfo.version_;
gitVer = gitVer.startsWith("~") ? gitVer[1 .. $] : "v"~gitVer;
string urlFilter(string url, bool is_image)
Expand Down

0 comments on commit 64ed9f8

Please sign in to comment.