SwipeX / PokeMate

Automated PokemonGo Application
GNU General Public License v3.0
111 stars 45 forks source link

Asyncronous Tasks and Mutex Lock Implementation #218

Closed SippieCup closed 8 years ago

SippieCup commented 8 years ago
  1. Rewrote how the taskController operates entirely. Runs each task a single time, each task repeats indefinitely in its own thread.
  2. All static sleeps have been removed and each API call is now surrouned by a Mutex lock which is unlocked after completing the call & waiting at least 300ms. PokeMate will never have any issues with the rate limit from now on as long as the API doesn't get rate limited within its own functions.
  3. We can now turn on/off features via Interrupts and spawning threads in real time.
  4. All tasks run concurrently and in real time rather than running in-order and then waiting 5 seconds.
  5. I had a wild and exciting friday night!
SippieCup commented 8 years ago

I can't read the Travis build details to fix it, but I am fairly certain its just a formatting thing.

I dont want to merge this until others are able to review it. Let me know what you guys think.

iDreamInBinary commented 8 years ago

Error:(30, 17) java: no suitable method found for submit(dekk.pw.pokemate.tasks.Navigate) method java.util.concurrent.ExecutorService.submit(java.util.concurrent.Callable) is not applicable (cannot infer type-variable(s) T (argument mismatch; dekk.pw.pokemate.tasks.Navigate cannot be converted to java.util.concurrent.Callable)) method java.util.concurrent.ExecutorService.submit(java.lang.Runnable,T) is not applicable (cannot infer type-variable(s) T (actual and formal argument lists differ in length)) method java.util.concurrent.ExecutorService.submit(java.lang.Runnable) is not applicable (argument mismatch; dekk.pw.pokemate.tasks.Navigate cannot be converted to java.lang.Runnable)

SippieCup commented 8 years ago

Thanks, for some reason it didnt merge the "implements runnable" on each class, my bad. Fixed.

gsisso commented 8 years ago

why you remove the item twice ?

                        context.getApi().getInventories().getItemBag().removeItem(id, count);
                        context.getApi().getInventories().getItemBag().removeItem(id, count - Config.getMinItemAmount());
SippieCup commented 8 years ago

Not sure where you are seeing that. Probably just a mistake on my part from being tired.

gsisso commented 8 years ago

you removed the first line in the latest commit, looks fine now.

SippieCup commented 8 years ago

Merging to Repo.