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

datapublisher.php batch export fix #1223

Merged
merged 1 commit into from
May 9, 2024

Conversation

GregoryPost
Copy link
Member

@GregoryPost GregoryPost commented May 6, 2024

When running datapublisher in batch mode, creation of MeasurementsOrFact extension file failed for all export files except the first file archive generated.

Pull Request Checklist:

Pre-Approval

  • There is a description section in the pull request that details what the proposed changes do. It can be very brief if need be, but it ought to exist.
  • Hotfixes should be branched off of the master branch and squash and merged back into the master branch.
  • Features and backlog bugs should be merged into the Development branch, NOT master
  • All new text is preferably internationalized (i.e., no end-user-visible text is hard-coded on the PHP pages), and the spreadsheet tracking internationalizations has been updated either with a new row or with checkmarks to existing rows.
  • There are no linter errors
  • New features have responsive design (i.e., look aesthetically pleasing both full screen and with small or mobile screens)
  • Symbiota coding standards have been followed
  • If any files have been reformatted (e.g., by an autoformatter), the reformat is its own, separate commit in the PR
  • Comment which GitHub issue(s), if any does this PR address
  • If this PR makes any changes that would require additional configuration of any Symbiota portals outside of the files tracked in this repository, make sure that those changes are detailed in this document.

Post-Approval

  • It is the code author's responsibility to merge their own pull request after it has been approved
  • If this PR represents a merge into the Development branch, remember to use the squash & merge option
  • If this PR represents a merge from the Development branch into the master branch, remember to use the merge option
  • If this PR represents a hotfix into the master branch, a subsequent PR from master into Development should be made merge option (i.e., no squash).
  • If the dev team has agreed that this PR represents the last PR going into the Development branch before a tagged release (i.e., before an imminent merge into the master branch), make sure to notify the team and lock the Development branch to prevent accidental merges while QA takes place. Follow the release protocol here.
  • Don't forget to delete your feature branch upon merge. Ignore this step as required.

Thanks for contributing and keeping it clean!

When running datapublisher in batch mode, creation of MeasurementsOrFact extension file failed for all export files except the first file archive generated.
@GregoryPost
Copy link
Member Author

I think this resolves BioKIC/symbiota-docs#299

@GregoryPost GregoryPost marked this pull request as ready for review May 6, 2024 17:29
Copy link
Member

@egbot egbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch on closing the file handler within DwcArchiverBaseManager file. Not closing it would cause the records left in the buffer to fail to write. Also possible file lock errors when moving or deleting.

@egbot egbot self-requested a review May 7, 2024 16:40
Copy link
Member

@egbot egbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably should keep the $this->attributeHandler->__destruct(); and $this->materialSampleHandler->__destruct(); and just set them to null afterward. Calling destruct method closes connections and log file handlers triggered within the extended manage class. Such as:

if($this->attributeHandler !== null){
$this->attributeHandler->__destruct();
$this->attributeHandler = null;
}

@egbot egbot closed this in 997de89 May 9, 2024
@egbot egbot reopened this May 9, 2024
@GregoryPost
Copy link
Member Author

The __destruct function is automatically called when the last reference to an object is removed. I tested locally and confirmed that DwcArchiverAttribute __destruct() is called when $this->attributeHandler = null; is executed.

@GregoryPost GregoryPost requested a review from egbot May 9, 2024 15:57
@egbot
Copy link
Member

egbot commented May 9, 2024

The __destruct function is automatically called when the last reference to an object is removed. I tested locally and confirmed that DwcArchiverAttribute __destruct() is called when $this->attributeHandler = null; is executed.

Yes, that sounds right. The __destruct function is automatically called when the object is destroyed, and thus does not need to be explicitly called.

Copy link
Member

@egbot egbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great as is

@GregoryPost GregoryPost merged commit b16da07 into Development May 9, 2024
@GregoryPost GregoryPost deleted the datapublisher-batchexport-traits-fix branch May 9, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants