simpler limit updates
This commit is contained in:
@@ -64,7 +64,7 @@ const AUTHENTICATED_USER_TARGETED = {
|
||||
const AUTHENTICATED_USER_SCOPED = {
|
||||
GET_HASH: Pinning.getHash,
|
||||
GET_TOTAL_SIZE: Pinning.getTotalSize,
|
||||
UPDATE_LIMITS: Quota.updateLimits,
|
||||
UPDATE_LIMITS: Quota.getUpdatedLimit,
|
||||
GET_LIMIT: Pinning.getLimit,
|
||||
EXPIRE_SESSION: Core.expireSessionAsync,
|
||||
REMOVE_PINS: Pinning.removePins,
|
||||
@@ -214,7 +214,6 @@ RPC.create = function (config, cb) {
|
||||
var Env = {
|
||||
historyKeeper: config.historyKeeper,
|
||||
intervals: config.intervals || {},
|
||||
defaultStorageLimit: config.defaultStorageLimit,
|
||||
maxUploadSize: config.maxUploadSize || (20 * 1024 * 1024),
|
||||
Sessions: {},
|
||||
paths: {},
|
||||
@@ -235,6 +234,10 @@ RPC.create = function (config, cb) {
|
||||
domain: config.domain // XXX
|
||||
};
|
||||
|
||||
Env.defaultStorageLimit = typeof(config.defaultStorageLimit) === 'number' && config.defaultStorageLimit > 0?
|
||||
config.defaultStorageLimit:
|
||||
Core.DEFAULT_LIMIT;
|
||||
|
||||
try {
|
||||
Env.admins = (config.adminKeys || []).map(function (k) {
|
||||
k = k.replace(/\/+$/, '');
|
||||
@@ -254,7 +257,7 @@ RPC.create = function (config, cb) {
|
||||
paths.blob = keyOrDefaultString('blobPath', './blob');
|
||||
|
||||
var updateLimitDaily = function () {
|
||||
Quota.updateLimits(Env, undefined, function (e) {
|
||||
Quota.updateCachedLimits(Env, function (e) {
|
||||
if (e) {
|
||||
WARN('limitUpdate', e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user