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

fix(cli/file-import): improvements and config(s) hashes or files #1056

Merged

Conversation

Davidmattei
Copy link
Member

@Davidmattei Davidmattei commented Oct 25, 2024

Q A
Bug fix? n
New feature? y
BC breaks? y
Deprecations? n
Fixed tickets? n
Documentation? y
  • Added a new CSV file helper: because the PhpOffice\PhpSpreadsheet\Reader\Csv was too slow in parsing big csv files (above 100K rows)
  • The file reader import command now works with json, hash or string configs, multiple configs will be merged into one.
  • Improved the factory httpClient for the coreApi: introduced two new parameters
    ** EMS_CORE_API_MAX_CONNECTIONS: define the max connections the coreApi can open (async)
    ** EMS_CORE_API_HEADERS: define extra headers for the coreApi (easy enable xdebug for the coreApi)
  • The file reader importer uses indexAsync which will index (create, update (merge or replace) the document from the row.
  • Added a queue object for queueing the responses and updating the progressBar

Symfony http client supports concurrent requests (async) out of the box. But we can not directly call getContent of getHeaders on the response object, this will block the execution. Instead just save the responses into an array and loop over for handling the responses. For this the queue was added, which will flush the responses on flushSize, calling the destruct of the symfony response object, which will check if the response was good, throwing exceptions on 300 - 500 status codes.

@Davidmattei Davidmattei self-assigned this Oct 25, 2024
@Davidmattei Davidmattei force-pushed the feat/config-cli-import-command branch 3 times, most recently from 6e27cc1 to 2559e6b Compare October 29, 2024 08:17
@Davidmattei Davidmattei force-pushed the feat/config-cli-import-command branch 3 times, most recently from 5e9b54f to eef4839 Compare November 1, 2024 14:19
The storage can search by fileHash or filePath, returning LocalFile or StorageFile
defaultData is always an array and empty if not defined.
Memory save and will return invalid (not parsable) rows
The client is only constructed from the CoreApiFactory.php, so we can safely refactor this.
And just pass the array as input to the factory.
No need for parameters 'ems_common.backend_api_verify' or 'ems_common.backend_api_timeout'

refactor: new common.core_api settings for verify andn timeout

And just pass the array as input to the factory.
No need for parameters 'ems_common.backend_api_verify' or 'ems_common.backend_api_timeout'
@Davidmattei Davidmattei force-pushed the feat/config-cli-import-command branch from 50d4e96 to 15ef994 Compare November 2, 2024 15:48
@Davidmattei Davidmattei marked this pull request as ready for review November 3, 2024 10:24
@Davidmattei Davidmattei requested a review from a team as a code owner November 3, 2024 10:24
@Davidmattei Davidmattei added this to the 5.24.0 milestone Nov 3, 2024
@Davidmattei Davidmattei requested a review from theus77 November 3, 2024 10:24
EMS/common-bundle/src/Common/CoreApi/ResponseQueue.php Outdated Show resolved Hide resolved
EMS/helpers/src/File/CsvFile.php Outdated Show resolved Hide resolved
EMS/helpers/src/File/CsvFile.php Outdated Show resolved Hide resolved
EMS/helpers/src/File/CsvFile.php Outdated Show resolved Hide resolved
EMS/helpers/src/File/CsvFile.php Outdated Show resolved Hide resolved
@Davidmattei Davidmattei force-pushed the feat/config-cli-import-command branch from 828ad6a to 0db327e Compare November 4, 2024 08:52
@Davidmattei Davidmattei merged commit 8f374fb into ems-project:5.x Nov 4, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants