Added rate limiting to heavy subscriptions
This commit is contained in:
@@ -52,3 +52,4 @@ ongoworks:speakingurl
|
|||||||
service-configuration@1.0.11
|
service-configuration@1.0.11
|
||||||
google-config-ui
|
google-config-ui
|
||||||
dynamic-import
|
dynamic-import
|
||||||
|
ddp-rate-limiter
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ Schemas.Character = new SimpleSchema({
|
|||||||
type: String,
|
type: String,
|
||||||
defaultValue: "whitelist",
|
defaultValue: "whitelist",
|
||||||
allowedValues: ["whitelist", "public"],
|
allowedValues: ["whitelist", "public"],
|
||||||
|
index: 1,
|
||||||
},
|
},
|
||||||
"settings.swapStatAndModifier": {type: Boolean, defaultValue: false},
|
"settings.swapStatAndModifier": {type: Boolean, defaultValue: false},
|
||||||
"settings.exportFeatures": {type: Boolean, defaultValue: true},
|
"settings.exportFeatures": {type: Boolean, defaultValue: true},
|
||||||
|
|||||||
@@ -25,3 +25,10 @@ Meteor.publish("characterList", function(){
|
|||||||
Parties.find({owner: userId}),
|
Parties.find({owner: userId}),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DDPRateLimiter.addRule({
|
||||||
|
name: "characterList",
|
||||||
|
type: "subscription",
|
||||||
|
userId(){ return true; },
|
||||||
|
connectionId(){ return true; },
|
||||||
|
}, 8, 5000);
|
||||||
|
|||||||
@@ -35,9 +35,16 @@ Meteor.publish("singleCharacter", function(characterId){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DDPRateLimiter.addRule({
|
||||||
|
name: "singleCharacter",
|
||||||
|
type: "subscription",
|
||||||
|
userId(){ return true; },
|
||||||
|
connectionId(){ return true; },
|
||||||
|
}, 8, 5000);
|
||||||
|
|
||||||
Meteor.publish("singleCharacterName", function(characterId){
|
Meteor.publish("singleCharacterName", function(characterId){
|
||||||
userId = this.userId;
|
userId = this.userId;
|
||||||
var char = Characters.findOne({
|
return Characters.find({
|
||||||
_id: characterId,
|
_id: characterId,
|
||||||
$or: [
|
$or: [
|
||||||
{readers: userId},
|
{readers: userId},
|
||||||
@@ -45,8 +52,7 @@ Meteor.publish("singleCharacterName", function(characterId){
|
|||||||
{owner: userId},
|
{owner: userId},
|
||||||
{"settings.viewPermission": "public"},
|
{"settings.viewPermission": "public"},
|
||||||
],
|
],
|
||||||
|
}, {
|
||||||
|
fields:{"name": 1}
|
||||||
});
|
});
|
||||||
if (char) {
|
|
||||||
return Characters.find(characterId, {fields:{"name": 1}});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user