Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] AfterImport being called twice with ChunkReading #2673

Closed
5 tasks done
dvmsk opened this issue May 18, 2020 · 3 comments
Closed
5 tasks done

[BUG] AfterImport being called twice with ChunkReading #2673

dvmsk opened this issue May 18, 2020 · 3 comments
Labels

Comments

@dvmsk
Copy link

dvmsk commented May 18, 2020

Prerequisites

Versions

  • PHP version: PHP 7.4.5
  • Laravel version: 7.10.3
  • Package version: 3.1.19

Description

AfterImport being triggered twice after every successful import with ChunkReading

Steps to Reproduce

<?php
class TestImport implements ToModel, WithProgressBar, WithEvents, WithHeadingRow, WithChunkReading
{
// ...
public function registerEvents(): array
    {
        return [
            AfterImport::class => function (AfterImport $event) {
                echo "\n==DONE==\n";
            },
        ];
    }
}

Expected behavior:
AfterImport event should be called once

Actual behavior:
AfterImport event fired twice.

 19501/20415 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░]  95%
==DONE==

==DONE==
 20415/20415 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

#1944 (comment)
#1944 (comment)
#1944 (comment)
#1944 (comment)
#1944 (comment)
#1944 (comment)

Additional Information

@dvmsk dvmsk added the bug label May 18, 2020
@patrickbrouwers
Copy link
Member

Can you create a failing test for this and if you find the root cause, feel free to PR a fix!

@patrickbrouwers
Copy link
Member

Issue was that listeners got registered again on the AfterImportJob. This shouldn't happen if the job isn't queued. Fixed for next release.

@ATOADER1
Copy link

ATOADER1 commented Jun 22, 2021

sheets() is called twice for me (excel 3.1.31/ PHP 7.4.3 / laravel 6 ) Could this be the same bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants