# Backgroundrb Problem running twice?

**URL:** <https://www.ruby-forum.com/t/backgroundrb-problem-running-twice/145530>\
**Category:** Ruby\
**Created:** [August 11, 2008, 9:39am UTC](https://www.ruby-forum.com/t/backgroundrb-problem-running-twice/145530 "2008-08-11T09:39:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![varunkumargoel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/ed8c4c/32.png) [@varunkumargoel](https://www.ruby-forum.com/u/varunkumargoel)\
**Post date:** [August 11, 2008, 9:39am UTC](https://www.ruby-forum.com/t/backgroundrb-problem-running-twice/145530/1 "2008-08-11T09:39:09Z")

</div>

## My experience through Backgroundrb is good it’s working fine for me but i got one issue in this pls help me out?I hope some problem in scheduling the task? my config

* * *

## port: “3333” timer\_sleep: 60 load\_rails: true environment: development rails\_env: development host: localhost database\_yml: config/database.yml acl: deny: all allow: localhost 127.0.0.1 order: deny,allow

## my worker

class PsWorker \< BackgrounDRb::Rails

repeat\_every 2.minutes  
first\_run Time.now

def do\_work(args)  
# This method is called in it’s own new thread when you  
# call new worker. args is set to :args

# logger.debug('DO\_WORK '+args.inspect)

```
Sende1.deliver_test()

```

end  
end

This is working fine in both windows and linux but it generate mail  
twice after very two mins why?this is my problem pls give me your  
suggestions.

Thanks  
Varun

---

<div class="post-metadata">

**Author:** ![varunkumargoel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/ed8c4c/32.png) [@varunkumargoel](https://www.ruby-forum.com/u/varunkumargoel)\
**Post date:** [August 29, 2008, 12:10pm UTC](https://www.ruby-forum.com/t/backgroundrb-problem-running-twice/145530/2 "2008-08-29T12:10:20Z")

</div>

solution for this is:

@@running=false

def do\_work(args)  
if not @@running  
@@running=true  
  
@@running=false  
end  
end
