# Plugin rake task running multiple times - what are we missing?

**URL:** <https://meta.discourse.org/t/plugin-rake-task-running-multiple-times-what-are-we-missing/210077>\
**Category:** Development\
**Created:** [November 24, 2021, 5:33pm UTC](https://meta.discourse.org/t/plugin-rake-task-running-multiple-times-what-are-we-missing/210077 "2021-11-24T17:33:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [August 23, 2023, 10:46am UTC](https://meta.discourse.org/t/plugin-rake-task-running-multiple-times-what-are-we-missing/210077/2 "2023-08-23T10:46:29Z")

</div>

Did you solve this?

I’m getting a similar issue:

If I create a rake take in a plugin, say: `lib/tasks/test.rake`

with contents

```plaintext
desc "count posts"
task "test_rake:test" => :environment do
  puts "Number of posts on this forum is #{Post.count}"
end

```

and run: `rake test_rake:test`

The output is surprising to me:

```plaintext
Number of posts on this forum is 366
Number of posts on this forum is 366
Number of posts on this forum is 366

```

I’m making some kind of error here, I’m sure, but not sure what?

Why is this running more than once and how to stop it?

I get a similar issue in Production which is, of course, more of a serious concern.

---

_[View the full topic](https://meta.discourse.org/t/plugin-rake-task-running-multiple-times-what-are-we-missing/210077)._
