0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【OSS版Dify Tips】Difyのループブロックで最大ループ時間を変更する方法

Last updated at Posted at 2025-06-09

はじめに

Difyのループブロックで最大ループ時間を変更するための環境構築方法を紹介する。長時間のポーリング処理などをしたい場合に有用。

動作環境

方法

./docker/.env.example./docker/.envにコピーして、以下の環境変数を修正する。

環境変数 説明 デフォルト値 変更例
APP_MAX_EXECUTION_TIME 最大実行時間(秒) 1200 36000
LOOP_NODE_MAX_COUNT 最大ループ数(回) 100 100000
WORKFLOW_MAX_EXECUTION_STEPS ワークフロー最大ステップ数(回) 500 100000
WORKFLOW_MAX_EXECUTION_TIME ワークフロー最大実行時間(秒) 1200 36000

ポイント
最大ループ回数だけでなく、ワークフロー実行時間のタイムアウトに関する環境変数も併せて修正する。

以下に、.envファイルのセクションごとに修正内容を記載する。

「OTLP Collector Configuration」セクションの修正

以下の環境変数を修正する。

  • APP_MAX_EXECUTION_TIME
変更前
# ------------------------------
# OTLP Collector Configuration
# ------------------------------

...

# The maximum number of active requests for the application, where 0 means unlimited, should be a non-negative integer.
APP_MAX_ACTIVE_REQUESTS=0
APP_MAX_EXECUTION_TIME=1200
変更後
# ------------------------------
# OTLP Collector Configuration
# ------------------------------

...

# The maximum number of active requests for the application, where 0 means unlimited, should be a non-negative integer.
APP_MAX_ACTIVE_REQUESTS=0
APP_MAX_EXECUTION_TIME=36000

「Others Configuration」セクションの修正

以下の環境変数を修正する。

  • LOOP_NODE_MAX_COUNT
  • WORKFLOW_MAX_EXECUTION_STEPS
  • WORKFLOW_MAX_EXECUTION_TIME
変更前
# ------------------------------
# Others Configuration
# ------------------------------

...

# Workflow runtime configuration
WORKFLOW_MAX_EXECUTION_STEPS=500
WORKFLOW_MAX_EXECUTION_TIME=1200

...

# Maximum loop count in the workflow
LOOP_NODE_MAX_COUNT=100
変更後
# ------------------------------
# Others Configuration
# ------------------------------

...

# Workflow runtime configuration
WORKFLOW_MAX_EXECUTION_STEPS=100000
WORKFLOW_MAX_EXECUTION_TIME=36000

...

# Maximum loop count in the workflow
LOOP_NODE_MAX_COUNT=100000

結果

ループ回数が増やせて、実行時間のタイムアウトが変更されていることが確認できた。

現状のUIの制約で、ループブロックのUI表示が3ケタまでしか画面に入り切れていないが、設定変更は正しくされており編集も可能。

image.png

image.png

既知の問題

error: timeout error: signal: killed

ワークフローのプレビューから実行すると、ワークフローが下記のエラーで止まることがある。再現性が今のところないため原因不明(調査中)。

image.png

まとめ

Difyのループブロックで最大ループ時間を変更するための環境構築方法を紹介した。長時間のポーリング処理などをしたい場合に有用なので試してみてほしい。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?