Raised This Month: $51 Target: $400
 12% 

JailBreak Achievements System v1.0.0 [NapoleoN#]


Post New Thread Reply   
 
Thread Tools Display Modes
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-15-2016 , 08:36   Re: JailBreak Achievements System v1.0.0 [NapoleoN#]
Reply With Quote #31

Quote:
Originally Posted by WAR3DM View Post
Tell that to the data wipes on server crash.
Your data doesn't wipe or get corrupted on server crash, it just doesn't save any changes since the last file opening. I believe the same happens with any open file descriptors at the time of program crash.
The key is to regularly re-open your vault, like every round or so, so changes get applied. You can even re-open it on every write if you want, I've never noticed any performance drops with that.

Also, you should not look into ways of going around crash consequences, but rather look for ways to stop your server from crashing.

Last edited by klippy; 07-15-2016 at 08:37.
klippy is offline
Old 07-15-2016, 08:43
WildCard65
This message has been deleted by WildCard65. Reason: Sniped by Klippy
WAR3DM
Senior Member
Join Date: Mar 2016
Old 07-15-2016 , 13:46   Re: JailBreak Achievements System v1.0.0 [NapoleoN#]
Reply With Quote #32

Quote:
Originally Posted by KliPPy View Post
Your data doesn't wipe or get corrupted on server crash, it just doesn't save any changes since the last file opening. I believe the same happens with any open file descriptors at the time of program crash.
The key is to regularly re-open your vault, like every round or so, so changes get applied. You can even re-open it on every write if you want, I've never noticed any performance drops with that.

Also, you should not look into ways of going around crash consequences, but rather look for ways to stop your server from crashing.
What if your server is running CSDM, when do you re-open your vault?

Crashes are bound to happen eventually, so that's not an option.

Last edited by WAR3DM; 07-15-2016 at 13:47.
WAR3DM is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-15-2016 , 15:11   Re: JailBreak Achievements System v1.0.0 [NapoleoN#]
Reply With Quote #33

Quote:
Originally Posted by WAR3DM View Post
What if your server is running CSDM, when do you re-open your vault?
Is the question here "What if the round never ends"? If so, set a time interval. 60, 30, 15 seconds, whatever. Every write/update?

Quote:
Originally Posted by WAR3DM View Post
Crashes are bound to happen eventually, so that's not an option.
That's true as with any program. Well, at least you can make sure that you lose only a minimal amount of data.
klippy is offline
WAR3DM
Senior Member
Join Date: Mar 2016
Old 07-15-2016 , 18:46   Re: JailBreak Achievements System v1.0.0 [NapoleoN#]
Reply With Quote #34

Thanks for the idea, I've updated this plugin with an auto-save every 30 seconds and the data persists through crash.

PHP Code:
public plugin_init() 
{
    
set_task(30.0"refreshVault", .flags "b");
}

public 
refreshVault()
{
    for( new 
Players 1Players <= get_maxplayers(); Players++ )
    {
        
SaveData(Players)
    }
    
nvault_close(gVault);
    
gVault nvault_open("AchievementSystem");                    

Let me know if any of my code can be optimized. Can't wait to fix the other plugin that turned me away from nVault in the first place.
.

Last edited by WAR3DM; 07-16-2016 at 01:47.
WAR3DM is offline
Reply



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 -4. The time now is 11:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode