add rate limit option for sessionserver

any outgoing requests to the sessionserver
that would exceed the configured rate limit are skipped
to prevent being blocked by CloudFront

if a texture hash is cached but outdated, the cache ttl will be bumped
as if the request succeeded, in order to lower requests in the near future
This commit is contained in:
jomo
2020-03-29 01:46:15 +01:00
parent d967db3ad4
commit 15a4f17560
6 changed files with 118 additions and 59 deletions

View File

@@ -695,6 +695,18 @@ describe("Crafatar", function() {
});
});
});
it("CloudFront rate limit is handled", function(done) {
var original_rate_limit = config.server.sessions_rate_limit;
config.server.sessions_rate_limit = 1;
networking.get_profile(rid(), uuid, function() {
networking.get_profile(rid(), uuid, function(err, profile) {
assert.strictEqual(err.code, "RATELIMIT");
config.server.sessions_rate_limit = original_rate_limit;
done();
});
});
});
});
after(function(done) {