[SOLVED] Pubsub rate limits

Are there any pubsub rate limits? The reason I am asking is because if I do more than 5 requests sequentially the next request get stuck in pending state forever.
Tried adding pauses between the requests up to 1 minute with no effect. The weirdest part is that the pending request always happens on the 6th iteration.

P.S. Marking this as solved. Forgot to close the subscription on each iteration.