Skip to content

Commit 00634ee

Browse files
committed
Serialize only the necessary info
1 parent 791d6f4 commit 00634ee

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/AsyncTask.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,24 @@ public function __construct(Closure|AsyncTaskInterface $theTask)
9999
$this->theTask = $theTask;
100100
}
101101

102+
public function __serialize(): array
103+
{
104+
// serialize only the necessary info to reduce runner cmd length
105+
return [
106+
'theTask' => serialize($this->theTask),
107+
'timeLimit' => $this->timeLimit,
108+
];
109+
}
110+
111+
public function __unserialize($data): void
112+
{
113+
[
114+
'theTask' => $tempTask,
115+
'timeLimit' => $this->timeLimit,
116+
] = $data;
117+
$this->theTask = unserialize($tempTask);
118+
}
119+
102120
/**
103121
* Inside an available PHP process, runs this AsyncTask instance.
104122
*

0 commit comments

Comments
 (0)