#Database Async Stuff not running

1 messages · Page 1 of 1 (latest)

fiery valley
#

I seem to have an issue with my UserInfo loader. I'm now running Database operations Async, but it seems they aren't running at all, for whatever reason.

#
  • I can share code if you want, unless this is a very easy fix?
serene burrow
fiery valley
#

Willdo

#

It can be found all the way at the bottom

serene burrow
#

abstract your database to a proper class

fiery valley
#

And that will fix the async operations not running issue?

serene burrow
#

uh no

#

i guess they are running

#

add some system.out lines under the code that you want to check if it ran

fiery valley
#

👍

serene burrow
#

but your values are updated async, that would mean if you try to access them from another thread, they might have been updated already or not, cuz databases are slow and the query can be still in progress

fiery valley
#

Ahhhh

fiery valley
serene burrow
#

i think your problem is the combination of sync/ async

#

is there any chance that your project is on github?

fiery valley
#

There is not, I really try to not share the code because it's "Staff Information", and I don't want to be the type of owner to break staff policies

serene burrow
#

hmm

fiery valley
#

I can share stuff, I just don't want to share what I don't have to

#

I'm confused however, the task is running and it is getting information and all that - the values just aren't being updated in the actual instance of Y_UserInfo

serene burrow
#

dont see any reason to call load() again after saving some user stuff to the database, as it saves it to the database and you immediately query the updated value back to set it locally

#

just do like this.receivingTpaRequests = VAL

#

conventions smh

#

instead of reloading stuff that isnt changed

#

abstract your database away from your userdata object

#

and call database.updateUser or smth whenever something changes locally

fiery valley
#

I see, so after someone toggles their displayrank to a different rank?

serene burrow
#

ye

fiery valley
#

What about my actionbar runnable, that displays shards and rank?

#

That stuff should just be updated de-facto, yes?

serene burrow
#

ye in the command, or just save users periodically java void onCommand(sender, stuff) { user.setRank(someRank); database.updateUser(); // async }

#

uhh actionbar runnable?

fiery valley
#

Yeah

#

It displays the user's rank, XYZ coordinates, and shards

serene burrow
#

thats information that is present in the userdata no?

fiery valley
#

That's what I figured