Skip to content

Commit c658e6a

Browse files
committed
Merge branch '4.x'
# Conflicts: # CHANGELOG.md # public/app.js # public/mix-manifest.json # src/Contracts/PrunableRepository.php
2 parents feb60f8 + 67bc181 commit c658e6a

File tree

8 files changed

+15296
-41
lines changed

8 files changed

+15296
-41
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# Release Notes
22

3-
## [Unreleased](https://github.com/laravel/telescope/compare/v4.5.1...master)
3+
## [Unreleased](https://github.com/laravel/telescope/compare/v4.6.0...master)
4+
5+
6+
## [v4.6.0 (2021-07-13)](https://github.com/laravel/telescope/compare/v4.5.1...v4.6.0)
7+
8+
### Added
9+
- Add a new "Clear Entries" button ([#1091](https://github.com/laravel/telescope/pull/1091))
10+
11+
### Changed
12+
- `Telescope:withoutRecording()` should be exception safe ([#1092](https://github.com/laravel/telescope/pull/1092))
13+
14+
### Fixed
15+
- Fixed frontend request polling memory leaks ([#1086](https://github.com/laravel/telescope/pull/1086))
16+
- Fix for `JobWatchers` when the job payload is encrypted ([#1089](https://github.com/laravel/telescope/pull/1089))
417

518

619
## [v4.5.1 (2021-06-22)](https://github.com/laravel/telescope/compare/v4.5.0...v4.5.1)

package-lock.json

Lines changed: 15237 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=12781ecb1d54769d6eb9",
2+
"/app.js": "/app.js?id=5fb4f607120d34b271ed",
33
"/app-dark.css": "/app-dark.css?id=bc22d805b64b5a2ecaaa",
44
"/app.css": "/app.css?id=d2d43f24f2a54d31e084"
55
}

resources/js/components/IndexScreen.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,20 @@
136136
'&take=1' +
137137
'&family_hash=' + this.familyHash
138138
).then(response => {
139-
this.recordingStatus = response.data.status;
139+
if (! this._isDestroyed) {
140+
this.recordingStatus = response.data.status;
140141
141-
if (response.data.entries.length && !this.entries.length) {
142-
this.loadNewEntries();
143-
} else if (response.data.entries.length && _.first(response.data.entries).id !== _.first(this.entries).id) {
144-
if (this.$root.autoLoadsNewEntries) {
142+
if (response.data.entries.length && !this.entries.length) {
145143
this.loadNewEntries();
144+
} else if (response.data.entries.length && _.first(response.data.entries).id !== _.first(this.entries).id) {
145+
if (this.$root.autoLoadsNewEntries) {
146+
this.loadNewEntries();
147+
} else {
148+
this.hasNewEntries = true;
149+
}
146150
} else {
147-
this.hasNewEntries = true;
151+
this.checkForNewEntries();
148152
}
149-
} else {
150-
this.checkForNewEntries();
151153
}
152154
})
153155
}, this.newEntriesTimer);

src/Contracts/PrunableRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface PrunableRepository
1111
*
1212
* @param \DateTimeInterface $before
1313
* @param bool $keepExceptions
14-
* @return void
14+
* @return int
1515
*/
1616
public function prune(DateTimeInterface $before, $keepExceptions);
1717
}

src/Telescope.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,11 @@ public static function withoutRecording($callback)
260260

261261
static::$shouldRecord = false;
262262

263-
call_user_func($callback);
264-
265-
static::$shouldRecord = $shouldRecord;
263+
try {
264+
call_user_func($callback);
265+
} finally {
266+
static::$shouldRecord = $shouldRecord;
267+
}
266268
}
267269

268270
/**

src/Watchers/JobWatcher.php

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
namespace Laravel\Telescope\Watchers;
44

55
use Illuminate\Bus\BatchRepository;
6+
use Illuminate\Contracts\Encryption\Encrypter;
67
use Illuminate\Queue\Events\JobFailed;
78
use Illuminate\Queue\Events\JobProcessed;
89
use Illuminate\Queue\Queue;
10+
use Illuminate\Support\Str;
911
use Laravel\Telescope\EntryType;
1012
use Laravel\Telescope\EntryUpdate;
1113
use Laravel\Telescope\ExceptionContext;
1214
use Laravel\Telescope\ExtractProperties;
1315
use Laravel\Telescope\ExtractTags;
1416
use Laravel\Telescope\IncomingEntry;
1517
use Laravel\Telescope\Telescope;
18+
use RuntimeException;
1619

1720
class JobWatcher extends Watcher
1821
{
@@ -180,8 +183,10 @@ protected function tags(array $payload)
180183
*/
181184
protected function updateBatch($payload)
182185
{
186+
$command = $this->getCommand($payload['data']);
187+
183188
$properties = ExtractProperties::from(
184-
unserialize($payload['data']['command'])
189+
$command
185190
);
186191

187192
if (isset($properties['batchId'])) {
@@ -196,4 +201,25 @@ protected function updateBatch($payload)
196201
));
197202
}
198203
}
204+
205+
/**
206+
* Get the command from the given payload.
207+
*
208+
* @param array $data
209+
* @return mixed
210+
*
211+
* @throws \RuntimeException
212+
*/
213+
protected function getCommand(array $data)
214+
{
215+
if (Str::startsWith($data['command'], 'O:')) {
216+
return unserialize($data['command']);
217+
}
218+
219+
if (app()->bound(Encrypter::class)) {
220+
return unserialize(app(Encrypter::class)->decrypt($data['command']));
221+
}
222+
223+
throw new RuntimeException('Unable to extract job payload.');
224+
}
199225
}

0 commit comments

Comments
 (0)