[PR #387] [MERGED] Remote plugin debugging: Skip 5-second sleep delay for faster development iteration #483

Closed
opened 2026-02-16 01:16:06 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-plugin-daemon/pull/387
Author: @Blackoutta
Created: 7/4/2025
Status: Merged
Merged: 7/7/2025
Merged by: @Yeuoly

Base: mainHead: optimize/skip-sleep-for-remote-run-time


📝 Commits (1)

  • fcbc3d9 optimize: skip sleep for remote plugin runtime during restart, making the debugging experience smoother

📊 Changes

1 file changed (+4 additions, -2 deletions)

View changed files

📝 internal/core/plugin_manager/lifecycle/full_duplex.go (+4 -2)

📄 Description

Description

This PR fixes a debugging experience issue where remote plugin reconnection fails after quick restart cycles. The problem was caused by a mandatory 5-second sleep delay in the plugin lifecycle that prevents rapid plugin restarts during development.

Changes made:

  • Modified internal/core/plugin_manager/lifecycle/full_duplex.go to skip the 5-second sleep delay for remote runtime plugins
  • Added runtime type check to only apply the delay for non-remote plugins
  • Improves developer experience during remote plugin debugging without affecting production behavior

This change allows developers to quickly restart remote plugins during debugging without encountering "no available node, plugin not found" errors.

Fixes #386

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Performance improvement
  • Other

Essential Checklist

Testing

  • I have tested the changes locally and confirmed they work as expected
  • I have added unit tests where necessary and they pass successfully

Bug Fix (if applicable)

  • I have used GitHub syntax to close the related issue (e.g., Fixes #123 or Closes #123)

Additional Information

Problem Context:
When debugging remote plugins, developers frequently need to make code changes and restart plugins quickly. The current 5-second mandatory sleep delay between plugin restarts causes reconnection failures, resulting in "no available node, plugin not found" errors.

Solution Details:
The fix conditionally applies the sleep delay based on plugin runtime type:

  • Remote plugins: No sleep delay (immediate restart for better debugging experience)
  • Non-remote plugins: Keep the 5-second delay (prevents excessive resource consumption)

Impact:

  • Improves developer experience during remote plugin debugging
  • Maintains existing behavior for production/non-remote plugins
  • No breaking changes to existing functionality

Code Change:

// Before
time.Sleep(5 * time.Second)

// After  
if r.Type() != plugin_entities.PLUGIN_RUNTIME_TYPE_REMOTE {
    time.Sleep(5 * time.Second)
}

Testing:
Verified that remote plugins can now be restarted quickly without connection errors during debugging sessions.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-plugin-daemon/pull/387 **Author:** [@Blackoutta](https://github.com/Blackoutta) **Created:** 7/4/2025 **Status:** ✅ Merged **Merged:** 7/7/2025 **Merged by:** [@Yeuoly](https://github.com/Yeuoly) **Base:** `main` ← **Head:** `optimize/skip-sleep-for-remote-run-time` --- ### 📝 Commits (1) - [`fcbc3d9`](https://github.com/langgenius/dify-plugin-daemon/commit/fcbc3d9b5179763c53d1b6c3bf8a78cbe2cc222c) optimize: skip sleep for remote plugin runtime during restart, making the debugging experience smoother ### 📊 Changes **1 file changed** (+4 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `internal/core/plugin_manager/lifecycle/full_duplex.go` (+4 -2) </details> ### 📄 Description ## Description This PR fixes a debugging experience issue where remote plugin reconnection fails after quick restart cycles. The problem was caused by a mandatory 5-second sleep delay in the plugin lifecycle that prevents rapid plugin restarts during development. **Changes made:** - Modified `internal/core/plugin_manager/lifecycle/full_duplex.go` to skip the 5-second sleep delay for remote runtime plugins - Added runtime type check to only apply the delay for non-remote plugins - Improves developer experience during remote plugin debugging without affecting production behavior This change allows developers to quickly restart remote plugins during debugging without encountering "no available node, plugin not found" errors. Fixes #386 ## Type of Change - [x] Bug fix - [ ] New feature - [ ] Refactor - [ ] Performance improvement - [ ] Other ## Essential Checklist ### Testing - [x] I have tested the changes locally and confirmed they work as expected - [ ] I have added unit tests where necessary and they pass successfully ### Bug Fix (if applicable) - [x] I have used GitHub syntax to close the related issue (e.g., `Fixes #123` or `Closes #123`) ## Additional Information **Problem Context:** When debugging remote plugins, developers frequently need to make code changes and restart plugins quickly. The current 5-second mandatory sleep delay between plugin restarts causes reconnection failures, resulting in "no available node, plugin not found" errors. **Solution Details:** The fix conditionally applies the sleep delay based on plugin runtime type: - Remote plugins: No sleep delay (immediate restart for better debugging experience) - Non-remote plugins: Keep the 5-second delay (prevents excessive resource consumption) **Impact:** - Improves developer experience during remote plugin debugging - Maintains existing behavior for production/non-remote plugins - No breaking changes to existing functionality **Code Change:** ```go // Before time.Sleep(5 * time.Second) // After if r.Type() != plugin_entities.PLUGIN_RUNTIME_TYPE_REMOTE { time.Sleep(5 * time.Second) } ``` **Testing:** Verified that remote plugins can now be restarted quickly without connection errors during debugging sessions. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 01:16:06 -05:00
yindo closed this issue 2026-02-16 01:16:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-daemon#483