limit number of /subscribe clients and queries per client

Add the following config variables (under [rpc] section):
  * max_subscription_clients
  * max_subscriptions_per_client
  * timeout_broadcast_tx_commit

Fixes #2826
This commit is contained in:
Anton Kaliaev
2019-02-05 14:50:36 +04:00
parent 5b7034a329
commit 0cddfdc81d
11 changed files with 110 additions and 2 deletions

View File

@ -318,6 +318,16 @@ func (w *WSEvents) OnStop() {
}
}
// TODO: remove
func (w *WSEvents) NumClients() int {
return 1
}
// TODO: remove
func (w *WSEvents) NumClientSubscriptions(clientID string) int {
return len(w.subscriptions)
}
func (w *WSEvents) Subscribe(ctx context.Context, subscriber string, query tmpubsub.Query, outCapacity ...int) (types.Subscription, error) {
q := query.String()