Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Bug Task#validate() gets called twice

Java Warlord
Joined
Nov 17, 2014
Messages
4,906
Let's say task x is added like this: TaskBot#add(x). In this case, everything works as intended, x.validate() gets called once per loop.

Now, there is a task y, which gets added with x.add(y)
y.validate()
gets called twice per loop (given that x validates, else it does not get called at all obviously).

The execute() method only gets called once afterwards.

I am 100% sure this is not caused by me, I tried setting up a barebones taskbot, and it still happens.

Given the complexity of some validate methods, this can cause quite some unnecessary resource usage.

@Cloud
 
Last edited:
Joined
Dec 10, 2014
Messages
3,332
Let's say task x is added like this: TaskBot#add(x). In this case, everything works as intended, x.validate() gets called once per loop.

Now, there is a task y, which gets added with x.add(y)
y.validate()
gets called twice per loop (given that x validates, else it does not get called at all obviously).

The execute() method only gets called once afterwards.

I am 100% sure this is not caused by me, I tried setting up a barebones taskbot, and it still happens.

Given the complexity of some validate methods, this can cause quite some unnecessary resource usage.

@Cloud
I think I've found the issue...
 
Although the fact that validate was called twice, and only executed once, means that the first validate returned false but the second returned true xD
 
Top