PDA

View Full Version : Data Buckets question


superpally1
10-20-2018, 09:08 PM
I have been using the data_buckets table alot lately.

Anyways, I have noticed that in the use of :quest::get_data(std::string bucket_key)
quest::set_data(std::string bucket_key, std::string bucket_value, std::string expires_in)
quest::delete_data(std::string bucket_key)

delete_data does not seem to work using perl.

Perhaps there is a delay from the time you call to delete the bucket and the actual time it is deleted from the database table?

It isn't a big deal. I just use an sql query to remove the buckets when needed, I was just curious if I missed something in my application of the functions.

Here is a very simple script that will show what I am talking about.
sub EVENT_SAY {

if($text=~/Hail/){
$client->Message(12,"" . quest::saylink("Make Bucket", 1) . "");
$client->Message(12,"" . quest::saylink("Get Bucket", 1) . "");
$client->Message(14,"" . quest::saylink("Delete Bucket", 1) . "");
$client->Message(14,"" . quest::saylink("Delete Bucket SQL", 1) . "");
}
if($text=~/Make Bucket/){ #Bucket set to 1 hour.
quest::set_data("testkey", "5", 3600);
$client->Message(12,"Data Bucket set.");
}
if($text=~/Get Bucket/){ #Displays the value of "testkey" which is 5.
$client->Message(12,"Data Bucket value is : (" . quest::get_data(testkey) . ")");
}
if($text=~/Delete Bucket/){ #Should work but doesn't.
$client->Message(12,"Attempting to delete the data bucket...");
quest::delete_data("testkey");
$client->Message(12,"Data Bucket value is : (" . quest::get_data(testkey) . ")");
}
if($text=~/Delete Bucket SQL/){ #Works, just a little more code.
$client->Message(12,"Attempting to delete the data bucket using SQL query...");
$connect = plugin::LoadMysql();
$sql_query = ("DELETE FROM data_buckets WHERE data_buckets.key='testkey'");
$sql_handler = $connect->prepare($sql_query);
$sql_handler->execute();
$connect->disconnect;
$client->Message(12,"Data Bucket value is : (" . quest::get_data(testkey) . ")");
}
}

Akkadius
10-20-2018, 09:31 PM
There should be zero delay in the deletion of a data bucket flag, all of the operations are atomic and happen immediately

I double checked the source on this and it looks like there was a copy pasta issue on the delete function that I'm not sure how that occurred because all of the tests were ran several times at one point

Either way I've pushed the fix and if you update your binaries you should be good to go natively

https://github.com/EQEmu/Server/commit/55197cf830f8ca926ab284656f2c2487505f313e

Let me know if you have further questions

superpally1
10-21-2018, 07:06 PM
Awesome. It isnt a big deal to just do it with the sql query but it is nice to have it working as intended. Thankyou sir!

Akkadius
10-21-2018, 07:07 PM
Awesome. It isnt a big deal to just do it with the sql query but it is nice to have it working as intended. Thankyou sir!

Thank you for bringing this up so we could get it addressed!