-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat: add configurable stop grace period for application containers #7125
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
Open
Jackman3005
wants to merge
2
commits into
coollabsio:next
Choose a base branch
from
questmate:feat/configurable-stop-grace-period
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
database/migrations/2025_11_05_091558_add_stop_grace_period_to_application_settings.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?php | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Database\Schema\Blueprint; | ||
| use Illuminate\Support\Facades\Schema; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| /** | ||
| * Run the migrations. | ||
| */ | ||
| public function up(): void | ||
| { | ||
| Schema::table('application_settings', function (Blueprint $table) { | ||
| $table->integer('stop_grace_period') | ||
| ->nullable() | ||
| ->after('use_build_secrets') | ||
| ->comment('Seconds to wait for graceful shutdown before forcing container stop (1-3600). Null uses default of 30 seconds.'); | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Reverse the migrations. | ||
| */ | ||
| public function down(): void | ||
| { | ||
| Schema::table('application_settings', function (Blueprint $table) { | ||
| $table->dropColumn('stop_grace_period'); | ||
| }); | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix type mismatch when loading stop grace period
stop_grace_periodis cast to integer on the model, but here you assign it directly topublic ?string $stopGracePeriod. When the stored value is, say, 60, Livewire will throwTypeError: Cannot assign int to property App\Livewire\Project\Application\Advanced::$stopGracePeriod of type ?string. Cast the value to string (or change the property type) before assignment, e.g.:🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll look into this. I think it was working without a cast as I could refresh the page with a number configured and it worked.
The reason I use a string here is the user cannot set the current value to
nullafter they have entered any content. So to fix problems with the change indicator incorrectly identifying an empty string as a change from the previous value ofnullI found it easiest to convert to string and back again after. Happy to adjust if someone has a suggestion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jackman3005, you're right to be concerned about dirty detection, and your approach of converting
null→''is sound for that use case. However, the explicit cast is still necessary for type safety.What's likely happening is that PHP or Livewire is performing implicit type coercion in your current setup, which can work in many cases but isn't guaranteed and can break with strict type checking enabled. Since
stop_grace_periodis cast tointegeron the model, when the value is, say,60, you're assigningint(60)to a?stringproperty, which should trigger aTypeErrorin strict PHP 8+.The bot's suggestion actually preserves your dirty detection fix while adding the necessary type safety:
This still converts
nullto''(preventing dirty detection issues), but also explicitly casts non-null integers to strings (e.g.,60→'60'), ensuring the assignment matches your?stringproperty type. YoursaveStopGracePeriod()method already handles the reverse conversion ((int) $this->stopGracePeriod), so the round-trip behavior remains intact.I'd recommend accepting the bot's suggestion—it maintains your intended behavior while being more robust.