EVENT_AFTER_SAVE_ELEMENT triggered twice after saving an entry I had this weird issue, not sure if that happens to you guys or not.

I'm trying to catch the 'after entry is saved' event, using the following code in my custom module's init() function (The module's code is generated by pluginfactory.io):

Event::on(
    \craft\services\Elements::class,
    \craft\services\Elements::EVENT_AFTER_SAVE_ELEMENT,
    function (\craft\events\ElementEvent $event) {
        $element = $event-&gt;element;
        if($element instanceof \craft\elements\Entry) {
            // Craft::info('Entry saved: ' . $element-&gt;title, __METHOD__);
        }
    }
);


It seems to work by testing on saving an entry in the CP, but the weird thing is this event seems to be triggered twice according to the log:

2019-08-16 12:21:52 [-][1][-][info][modules\testmodule\{closure}] Entry saved: Document translation
2019-08-16 12:21:52 [-][1][-][info][modules\testmodule\{closure}] Entry saved: Document translation
2019-08-16 12:21:52 [-][1][-][info][application] $_GET = [
    'p' =&gt; 'admin/entries/pages/234-document-translation'
]


I also tried Andrew's answer in this post: https://craftcms.stackexchange.com/a/26815/7136, but same thing happened.

Event::on(
    \craft\elements\Entry::class,
    \craft\elements\Entry::EVENT_AFTER_SAVE,
    function (\craft\events\ModelEvent $event) {
        Craft::debug(
            '\craft\elements\Entry::EVENT_AFTER_SAVE',
            __METHOD__
        );
    }
);


I certainly don't want my custom code to be executed twice. Is this a bug or an expected behavior?

Craft version: 3.2.10
You can find out what the stack trace is (who is calling you) by putting something like this in your anonymous function:

                try {
                    throw new \Exception();
                } catch (\Exception $e) {
                    Craft::debug(
                        'EVENT_AFTER_SAVE_ELEMENT '.$e-&gt;getTraceAsString(),
                        __METHOD__
                    );
                }


Then search on EVENT_AFTER_SAVE_ELEMENT in your web.log