# Should rake task be spawned?

**URL:** <https://www.ruby-forum.com/t/should-rake-task-be-spawned/140674>\
**Category:** Rails\
**Created:** [June 17, 2008, 12:02pm UTC](https://www.ruby-forum.com/t/should-rake-task-be-spawned/140674 "2008-06-17T12:02:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [June 17, 2008, 12:02pm UTC](https://www.ruby-forum.com/t/should-rake-task-be-spawned/140674/1 "2008-06-17T12:02:56Z")

</div>

Hi  
I have rake code as below…What I am doing is sending mail to

sd\_records=ServiceDeskTicket.find :all, :conditions=\>[“updated\_on \< ?  
and service\_desk\_status\_id != ?”,48.hours.ago,6]  
for record in sd\_records  
puts “Service desk number is #{record.number}”  
#Now to each such sd ticket primary group assignee mails is to  
be send

```
    end

Here inside for loop I have to send mail to primary_assignee of the

```

group responsible for each of the service desk ticket…This rake task is  
executed on each 1 hour…So my question is should the mail sending  
portion (inserting in for loop) be done as seperate threads…I am using  
spawn to that…My doubt is if say some thousands of service desk tickets  
this will create that much processes…Is that the right solution?Or not  
spawn it just continue and write code for mail send in the above for  
loop…Could you please give me a good advise?

Thanks in advance  
Sijo
