Plugin init function executed more than once To test a service method, I'm executing it in my init function. The method adds a row to the database table with a mail address and variant id:

$this-&gt;waitingListService-&gt;add(7, 'email@mailserver.com');


However, when I refresh a page in the control page to execute the plugin init function 2, or sometimes 3 rows are being added to the database table.

Is this the default behaviour and if not, how can I fix it?

Thanks in advance,
Sam
The init function should only trigger once for each instance. So when you do something like new Plugin it is executed multiple times. 

But keep in mind that it is executed in every request. So when you are in the CP there are many different ajax calls (every time when you reload entries at the index page for example). You'll create a new row for each of those requests

In order to disable your function you can check 

$request = Craft::$app-&gt;getRequest();
if (!$request-&gt;getIsAjax() &amp;&amp; !$request-&gt;getIsConsoleRequest()) {

}