wahabmirjan / wp-simple-nonce

A very simple NONCE for WordPress developers.
GNU General Public License v2.0
38 stars 11 forks source link

Creating too many nonces causes performance issues #12

Open kimek opened 2 years ago

kimek commented 2 years ago

Hi Guys, I know that this plugin is only for developer use. I just want to let you know (and leave a note for myself) that many records of wp-simple-nonce can harm performance of wordpress.

Function storeNonce() ( https://github.com/wahabmirjan/wp-simple-nonce/blob/25a11a52a59d0fa6067db61e8a089aee23887716/WPSimpleNonce.php#L77 ) save records with autoload = yes (default by wordpress https://developer.wordpress.org/reference/functions/add_option/ ). I had thousand of them (only) and this harm badly performance of my website in development stage.

I will try to make a pull request in near future, for a now you have my notes here. Just letting you know.

Thanks

wahabmirjan commented 2 years ago

There was an issue with clearing up nonces. Update to the latest version and see if your problem persists.

kimek commented 2 years ago

Thanks for fast replay @wahabmirjan Issue is a bit with add_option part, mainly, as this is set to default auto = yes If you have 1 thousand user they create 2 thousand rows and each page needs use add_options autoload. Therefore you are affecting all the websites, including pages which not using Nonce.

wahabmirjan commented 2 years ago

OK, thanks for clarification. I will investigate. That said, the title of this issue is misleading. I will change it.