Merge remote-tracking branch 'origin/master' into flakes
This commit is contained in:
commit
022287060b
2 changed files with 7 additions and 2 deletions
|
@ -363,9 +363,10 @@ struct CurlDownloader : public Downloader
|
||||||
} else if (httpStatus == 401 || httpStatus == 403 || httpStatus == 407) {
|
} else if (httpStatus == 401 || httpStatus == 403 || httpStatus == 407) {
|
||||||
// Don't retry on authentication/authorization failures
|
// Don't retry on authentication/authorization failures
|
||||||
err = Forbidden;
|
err = Forbidden;
|
||||||
} else if (httpStatus >= 400 && httpStatus < 500 && httpStatus != 408) {
|
} else if (httpStatus >= 400 && httpStatus < 500 && httpStatus != 408 && httpStatus != 429) {
|
||||||
// Most 4xx errors are client errors and are probably not worth retrying:
|
// Most 4xx errors are client errors and are probably not worth retrying:
|
||||||
// * 408 means the server timed out waiting for us, so we try again
|
// * 408 means the server timed out waiting for us, so we try again
|
||||||
|
// * 429 means too many requests, so we retry (with a delay)
|
||||||
err = Misc;
|
err = Misc;
|
||||||
} else if (httpStatus == 501 || httpStatus == 505 || httpStatus == 511) {
|
} else if (httpStatus == 501 || httpStatus == 505 || httpStatus == 511) {
|
||||||
// Let's treat most 5xx (server) errors as transient, except for a handful:
|
// Let's treat most 5xx (server) errors as transient, except for a handful:
|
||||||
|
|
|
@ -16,6 +16,8 @@ public:
|
||||||
|
|
||||||
const Setting<Path> sshKey{(Store*) this, "", "ssh-key", "path to an SSH private key"};
|
const Setting<Path> sshKey{(Store*) this, "", "ssh-key", "path to an SSH private key"};
|
||||||
const Setting<bool> compress{(Store*) this, false, "compress", "whether to compress the connection"};
|
const Setting<bool> compress{(Store*) this, false, "compress", "whether to compress the connection"};
|
||||||
|
const Setting<Path> remoteProgram{this, "nix-daemon", "remote-program", "path to the nix-daemon executable on the remote system"};
|
||||||
|
const Setting<std::string> remoteStore{this, "", "remote-store", "URI of the store on the remote system"};
|
||||||
|
|
||||||
SSHStore(const std::string & host, const Params & params)
|
SSHStore(const std::string & host, const Params & params)
|
||||||
: Store(params)
|
: Store(params)
|
||||||
|
@ -82,7 +84,9 @@ ref<FSAccessor> SSHStore::getFSAccessor()
|
||||||
ref<RemoteStore::Connection> SSHStore::openConnection()
|
ref<RemoteStore::Connection> SSHStore::openConnection()
|
||||||
{
|
{
|
||||||
auto conn = make_ref<Connection>();
|
auto conn = make_ref<Connection>();
|
||||||
conn->sshConn = master.startCommand("nix-daemon --stdio");
|
conn->sshConn = master.startCommand(
|
||||||
|
fmt("%s --stdio", remoteProgram)
|
||||||
|
+ (remoteStore.get() == "" ? "" : " --store " + shellEscape(remoteStore.get())));
|
||||||
conn->to = FdSink(conn->sshConn->in.get());
|
conn->to = FdSink(conn->sshConn->in.get());
|
||||||
conn->from = FdSource(conn->sshConn->out.get());
|
conn->from = FdSource(conn->sshConn->out.get());
|
||||||
initConnection(*conn);
|
initConnection(*conn);
|
||||||
|
|
Loading…
Reference in a new issue