From: praveen praveen on
Hi,

My code is like this:

if (row.abc1== 'pnc')


action1

end

if (abc2 == 'hjayu')

action2

end

Now the probelm is, before finishing the action1, it is going to perform
action2 & resulting crashing the system.

what might be the problem, can somebody pls help

Thanks in advance
apr
--
Posted via http://www.ruby-forum.com/.

From: Andrea Dallera on
Does action1 run on a different thread than the one the method was
called? Like:

def action1
Thread.new do
#your code here
end
end

Be wary that it might be that what happens inside action1 runs on a
different thread, just not explicitly like this, for example it might
call a library that runs its stuff on a separate thread. Could you show
more of what happens inside action1() ?

--
Andrea Dallera
http://github.com/bolthar/freightrain
http://usingimho.wordpress.com


On Thu, 2010-03-18 at 22:43 +0900, praveen praveen wrote:
> Hi,
>
> My code is like this:
>
> if (row.abc1== 'pnc')
>
>
> action1
>
> end
>
> if (abc2 == 'hjayu')
>
> action2
>
> end
>
> Now the probelm is, before finishing the action1, it is going to perform
> action2 & resulting crashing the system.
>
> what might be the problem, can somebody pls help
>
> Thanks in advance
> apr


From: apr apr on
Andrea Dallera wrote:
> Does action1 run on a different thread than the one the method was
> called? Like:
>
> def action1
> Thread.new do
> #your code here
> end
> end
>
> Be wary that it might be that what happens inside action1 runs on a
> different thread, just not explicitly like this, for example it might
> call a library that runs its stuff on a separate thread. Could you show
> more of what happens inside action1() ?
>
> --
> Andrea Dallera
> http://github.com/bolthar/freightrain
> http://usingimho.wordpress.com

Thanks for ur reply Andrea,

It is like this,

if (abc1 = fgd)
click link1
enter value1
enter value2
click ok
end
if (abc2 = fge)
click link2
select a check box1
enter value1
click ok
end

Thanks
apr



--
Posted via http://www.ruby-forum.com/.

From: Andrea Dallera on
Hei,


> if (abc1 = fgd)
> click link1
> enter value1
> enter value2
> click ok
> end
> if (abc2 = fge)
> click link2
> select a check box1
> enter value1
> click ok
> end

Still, i don't understand what's going on :)
One quick and dirty (REALLY dirty) fix might be to check, before the
abc2 == (mind the ==, NOT = ) fge condition evaluation, if the system is
in a suitable state for the operation to be run and, if not, wait a
little until it's ready. Something like:


if (abc1 == fgd)
click link1
enter value1
enter value2
click ok
end

while !operation_over?
sleep(1)
end

if (abc2 = fge)
click link2
select a check box1
enter value1
click ok
end

where operation_over? is a method that you will have to write that
checks for the system to be in a proper state: it should return true if
the operation run after the first condition is over, false otherwise.
But really, think twice before doing this: the problem you're
experiencing derives from some global value you're changing, and
global's bad :-) i suggest you check for what's going on deep under and
fix the underlying problem instead of writing this hack.

--
Andrea Dallera
http://github.com/bolthar/freightrain
http://usingimho.wordpress.com



 | 
Pages: 1
Prev: BTJunkie crawler
Next: net-ldap 0.1.1 Released