fix: return at least one in sizeCalculation (#10832)

if post content is empty post cache should still consider its size to be at least one. fixes #10831
isekai-main
Opliko 3 years ago committed by GitHub
parent 8936f412d1
commit 15ca460c8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,7 +6,7 @@ const meta = require('../meta');
module.exports = cacheCreate({ module.exports = cacheCreate({
name: 'post', name: 'post',
maxSize: meta.config.postCacheSize, maxSize: meta.config.postCacheSize,
sizeCalculation: function (n) { return n.length; }, sizeCalculation: function (n) { return n.length || 1; },
ttl: 0, ttl: 0,
enabled: global.env === 'production', enabled: global.env === 'production',
}); });

Loading…
Cancel
Save