Go Back   WowAce Forums > Addon Chat > Frameworks > Ace3
Ace3 Ace3 framework discussion

Reply
 
Thread Tools
Old 11-25-2010   #11
Arkayenro
Hero Member
 
Join Date: Dec 2006
Posts: 664
Default Re: AceDB Resetting, Help Please

Quote:
Originally Posted by Kithulhu View Post
I've had a few more people get back to me on it as well, it looks like its very intermittant, one friend who is an altoholic was playing for the last 2 days with no issues, but today suddenly the DB was gone and this time ReloadUI did nothing to fix it and i've still yet to have the problem myself.
ive had the same thing reported to me for my mod over its lifespan, part or all of the database is just gone on one toon, it was working fine before and then they login and its gone, you dont even have to have changed the mod in any way. but ive never experienced it myself. i've always put it down to a corrupt savedvariables file but i would have thought that would have generated an error of some sort.
Arkayenro is offline   Reply With Quote
Old 11-25-2010   #12
Phanx
Seal Cub Clubbing Club
 
Phanx's Avatar
 
Join Date: May 2005
Location: United States
Posts: 8,188
Default Re: AceDB Resetting, Help Please

Profile resetting doesn't affect the "global" section of your DB.

If you do:
Code:
self.db = LibStub("AceDB-3.0"):New("MyAddonDB")
You have this:
Code:
self.db = {
	char = { },
	realm = { },
	class = { },
	race = { },
	faction = { },
	factionrealm = { },
	global = { },
	profile = { },
}
Note that the "char", "realm", and "class" sections of the database are NOT profiles. While AceDB defualts to "character-specific profiles" this is done using the "profile" section of the database, NOT the "char" section. The "char" section is for data that's only accessible from the current character. A "character-specific" profile is still a profile, and can be used by other characters.

The only section of the database that is affected by a profile change (including creating a new profile, switching to a different profile, resetting a profile, or deleting a profile) is the "profile" section.

As for the mysterious resetting, there may be an actual cause for it in your code, but since you didn't post all of your code, there's no way for anyone but you to look into that. It's also possible that the people reporting "halp my settingz is gone" are failing to mention that WoW crashed or they quit WoW by pressing Alt-F4. If the game client doesn't quit normally, it doesn't go through the "shutdown" process that includes writing saved variables to disk.
__________________
Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge
Troubleshoot an addon | Turn any code into an addon | More addon resources
Need help with your code? Attach or paste your whole, real files.
Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead!
Phanx is offline   Reply With Quote
Old 11-25-2010   #13
Kithulhu
Newbie
 
Join Date: Nov 2010
Posts: 8
Default Re: AceDB Resetting, Help Please

Quote:
Originally Posted by Phanx View Post
As for the mysterious resetting, there may be an actual cause for it in your code, but since you didn't post all of your code, there's no way for anyone but you to look into that. It's also possible that the people reporting "halp my settingz is gone" are failing to mention that WoW crashed or they quit WoW by pressing Alt-F4. If the game client doesn't quit normally, it doesn't go through the "shutdown" process that includes writing saved variables to disk.
I didn't want to post the whole mod, but if you're willing, the code is downloadable in the mod itself (ShivvAudio on Curse(forge)) though I went through it myself looking for anything that alters things in the .global table and the only things were additions/deltions in the form of self.db.global.mediaDB[var] = {} (or nil).

Could it be a timing issue with WoW and Ace3 where somethings maybe aren't entirely loaded by the time Mod:OnInitialize() is called, so dumping it down to OnEnable would be beneficial? Or more to the point, is there anything that will go wrong if the db is setup in Enable instead of Init (of course, assuming I don't look at anything til OnEnable which is currently the case anyhow).
Kithulhu is offline   Reply With Quote
Old 11-25-2010   #14
Adirelle
Legendary Member
 
Adirelle's Avatar
 
Join Date: Dec 2006
Posts: 2,386
Default Re: AceDB Resetting, Help Please

Quote:
Originally Posted by Kithulhu View Post
Could it be a timing issue with WoW and Ace3 where somethings maybe aren't entirely loaded by the time Mod:OnInitialize() is called, so dumping it down to OnEnable would be beneficial?
Beside some corner cases, it shouldn't. mod:OnInitialize is run when the ADDON_LOADED event is received. At this point, the saved variables are available (that the point of that event).

Quote:
Or more to the point, is there anything that will go wrong if the db is setup in Enable instead of Init (of course, assuming I don't look at anything til OnEnable which is currently the case anyhow).
As long as you never enable/disable the addon, nothing wrong should happen.
__________________
Author of AdiButtonAuras, AdiBags, Squire2 and several other addons.

Each time you hit your "copy" command with a block of code, think about a way to refactor it so it did what you want without using the "paste" command.
Adirelle is offline   Reply With Quote
Old 11-25-2010   #15
Nevcairiel
Super Moderator
 
Nevcairiel's Avatar
 
Join Date: Aug 2005
Location: Germany/Hamburg
Posts: 1,823
Default Re: AceDB Resetting, Help Please

One thing that can and will break it is calling LoadAddon in your main chunk, that is outside of any functions. If you must load some other addon, just put up a dependency, or load it in OnInit or even later.
__________________
Author/Maintainer of Ace3, Bartender4, Mapster, Quartz, HotCandy, and various small and helpful addons.
You can Donate if you want, any help is appreciated!
Nevcairiel is offline   Reply With Quote
Old 11-25-2010   #16
Adirelle
Legendary Member
 
Adirelle's Avatar
 
Join Date: Dec 2006
Posts: 2,386
Default Re: AceDB Resetting, Help Please

Quote:
Originally Posted by Nevcairiel View Post
load it in OnInit or even later.
You shouldn't be able to load any addon with LoadAddOn before PLAYER_LOGIN (e.g. OnEnable) anyway.
__________________
Author of AdiButtonAuras, AdiBags, Squire2 and several other addons.

Each time you hit your "copy" command with a block of code, think about a way to refactor it so it did what you want without using the "paste" command.
Adirelle is offline   Reply With Quote
Old 11-25-2010   #17
Nevcairiel
Super Moderator
 
Nevcairiel's Avatar
 
Join Date: Aug 2005
Location: Germany/Hamburg
Posts: 1,823
Default Re: AceDB Resetting, Help Please

Where did you get that wisdom?
You can LoadAddOn whenever you wish, and it will load that addon just fine.
It will just break the AceAddon initialization logic if too many ADDON_LOADED fire in a weird order.
__________________
Author/Maintainer of Ace3, Bartender4, Mapster, Quartz, HotCandy, and various small and helpful addons.
You can Donate if you want, any help is appreciated!
Nevcairiel is offline   Reply With Quote
Old 11-25-2010   #18
Dridzt
Hero Member
 
Dridzt's Avatar
 
Join Date: Nov 2005
Posts: 873
Default Re: AceDB Resetting, Help Please

If you mean a user created addon then it should "mostly" be fine.

It's definitely a bad idea to force load Blizzard_* load on demand addons too early blindly.

If you want a specific example look at addons that were force loading Blizzard_GuildUI too early and in the process breaking the in-game Calendar.

So no.. it's not a good idea to just load whenever you want whenever you want with no qualification.

That's probably not what you meant but last post came out as "LoadAddOn() whenever you wish it's fine"
Dridzt is offline   Reply With Quote
Old 11-25-2010   #19
Xinhuan
Asian Sheep Lover
 
Xinhuan's Avatar
 
Join Date: Aug 2007
Location: Singapore
Posts: 4,033
Default Re: AceDB Resetting, Help Please

If you want a Blizzard_* addon to load before yours, you either

A) RequiredDeps it

Or

B) Make your addon LoadOnDemand, and put that Blizzard_* addon as a LoadWith entry.
__________________
Author/Maintainer of Postal, Omen3, GemHelper, BankItems, WoWEquip, GatherMate, Routes, HandyNotes and some others.
Xinhuan is offline   Reply With Quote
Old 11-25-2010   #20
Dridzt
Hero Member
 
Dridzt's Avatar
 
Join Date: Nov 2005
Posts: 873
Default Re: AceDB Resetting, Help Please

(B) is good, (A) is bad.

A is exactly what broke guild events in calendar for a bunch of people.

C. register ADDON_LOADED, watch for "Blizzard_*" as arg and do whatever you needed from the Blizz LoD addon after it loads.
Dridzt is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:01 AM.