# Any way to turn off RateLimiter temporarily for bulk creation by admin?

**URL:** <https://meta.discourse.org/t/any-way-to-turn-off-ratelimiter-temporarily-for-bulk-creation-by-admin/138825>\
**Category:** Development\
**Created:** [January 16, 2020, 2:28pm UTC](https://meta.discourse.org/t/any-way-to-turn-off-ratelimiter-temporarily-for-bulk-creation-by-admin/138825 "2020-01-16T14:28:38Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![jamesmarkcook](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesmarkcook/32/168563_2.png) [@jamesmarkcook](https://meta.discourse.org/u/jamesmarkcook)\
**Post date:** [January 16, 2020, 2:28pm UTC](https://meta.discourse.org/t/any-way-to-turn-off-ratelimiter-temporarily-for-bulk-creation-by-admin/138825/1 "2020-01-16T14:28:38Z")

</div>

So here is my issue. I have a requirement to essentially seed a Discourse production instance with around 200 posts at a time from a plugin admin action. These posts will be ‘created by’ 1 of 10 different regular users. The reason it’s a plugin action is because the users of this particular instance have a team of moderators they want to train up, and wanted some test posts to train them on, and the ability to seed more when they need them.

I got this working fine by passing `skip_validations: true` to `PostCreator.new`, however now there’s a requirement that some of the created posts are also flagged.

I’m using `PostActionCreator.create` to flag some of these posts, but now I’m getting hit by the rate limiter here: [discourse/lib/post\_action\_creator.rb at ad7a13921f2af8c792530c84386b64911c8e7ea2 · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/ad7a13921f2af8c792530c84386b64911c8e7ea2/lib/post_action_creator.rb#L69)

I first attempted to disable the `RateLimiter` but that was causing my action to crash the server process eventually, possibly when I was trying to turn it back on, and then I realised it probably wasn’t a good idea anyway.

So my question is, is there a better way to bypass the rate limiter when running some arbitrary code i.e. something like:

```ruby
RateLimiter.bypass do
# run some code not affected by the rate limiter
end

```

Or do I need to basically just need to copy most of what the `PostActionCreator` is doing but leave out the troublesome line?

Any help would be greatly appreciated! I’m still absorbing a lot of the Discourse code so I’m aware I’ve probably missed something that makes this a lot easier!

---

_[View the full topic](https://meta.discourse.org/t/any-way-to-turn-off-ratelimiter-temporarily-for-bulk-creation-by-admin/138825)._
