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

大きなサイズのCSVを扱えるようタイムアウトを延長 #4563

Merged
merged 1 commit into from
Jun 25, 2020

Conversation

nanasess
Copy link
Contributor

@nanasess nanasess commented Jun 8, 2020

概要(Overview・Refs Issue)

src/Eccube/Resource/doctrine/import_csv 以下に、独自の初期化用CSV ファイルを配置することで、インストール時のデータを独自にカスタマイズ可能。
また、効率的にデータインポート可能なので、 memory_limit を越えたサイズの CSV ファイルも扱うことができる。

しかし大きなサイズの CSV ファイルを登録すると max_execution_time に抵触し、システムエラーになってしまう

方針(Policy)

set_time_limit() 関数でタイムアウトを延長する。

実装に関する補足(Appendix)

2系で実装されている、以下のコードを流用
https://github.com/EC-CUBE/ec-cube2/blob/4929cf1d0e4ab0b76cd4b3201998e72eeca2ccfb/data/class/util/SC_Utils.php#L1840-L1864

テスト(Test)

3,145,724行の mtb_country.csv を作成し、 memory_limit=128M の環境でインストール完了することを確認

ls -al | grep mtb_country
.rw-r--r--  128M nanasess  8 6 19:36  mtb_country.csv
wc -l mtb_country.csv
 3145725 mtb_country.csv
select count(*) from mtb_country;
+----------+
| count(*) |
+----------+
| 3145724  |
+----------+

相談(Discussion)

マイナーバージョン互換性保持のための制限事項チェックリスト

  • 既存機能の仕様変更
  • フックポイントの呼び出しタイミングの変更
  • フックポイントのパラメータの削除・データ型の変更
  • twigファイルに渡しているパラメータの削除・データ型の変更
  • Serviceクラスの公開関数の、引数の削除・データ型の変更
  • 入出力ファイル(CSVなど)のフォーマット変更

レビュワー確認項目

  • 動作確認
  • コードレビュー
  • E2E/Unit テスト確認(テストの追加・変更が必要かどうか)
  • 互換性が保持されているか
  • セキュリティ上の問題がないか

@okazy okazy added the improvement 機能改善 label Jun 9, 2020
@okazy okazy added this to the 4.0.x milestone Jun 9, 2020
@okazy
Copy link
Contributor

okazy commented Jun 25, 2020

ありがとうございます。
落ちているテストは今回の修正に起因するものではないのでスルーでOKかとおもいます。

Copy link
Contributor

@okazy okazy left a comment

Choose a reason for hiding this comment

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

ありがとうごじます!OKです。

@okazy okazy modified the milestones: 4.0.x, 4.0.5 Jun 25, 2020
@okazy okazy merged commit a235e40 into EC-CUBE:4.0 Jun 25, 2020
@okazy
Copy link
Contributor

okazy commented Jun 25, 2020

ありがとうございます。マージしました。

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

Successfully merging this pull request may close these issues.

None yet

2 participants