70 questions
-1
votes
1
answer
65
views
PHP Socket fails to read server response
I'm using Amphp version 2.6 to create asynchronous socket connections to a Minecraft server. During this connection I send integers, strings and bytes to the server in order to retrieve info from a ...
1
vote
0
answers
101
views
How to use amphp with postgres transactions?
My code runs inside worker, so it executes in parallel way.
I wanted to use postgres transactions with amp/postgres library, so I wrote this code:
public static function ...
0
votes
0
answers
70
views
How to use constants inside Amp\parallelMap in PHP?
I need some help with using global constants inside amp\parallelMap. I have a bootstrap file that I require_once in my project, where I define global constants like MAX_DATA.
Here's a simplified ...
2
votes
1
answer
297
views
How to use Revolt\EventLoop?
How to run below script using Revolt\EventLoop
use Amp\Loop;
Loop::Run(static function() {
echo "Callback function executed!" . PHP_EOL;
})
Im tried this code but it return blank ...
1
vote
1
answer
52
views
Irreconcilable dependencies in Composer
I have two composer packages that require different versions of the same dependency. I have found answers like this that help me diagnose the problem, but not how to resolve it.
Package A (amphp/...
1
vote
0
answers
150
views
In AMPHP Parallel, is there a way to get all the tasks which succeeded before a TimeoutCancellation (try catch block task)?
I've been working on parallelising some data pipelines with AMPHP in a large codebase, and now I'd like to allow a timeout for if one of the pipelines fails.
The exact behaviour I'm after is having a ...
0
votes
1
answer
170
views
Streaming results in amphp
My goal is to create a pipeline that could have tens of thousands of items in the iterator. Since this can take a long time to process, I want to steam the results back to the client as they are ...
0
votes
1
answer
198
views
Is it possible to have multiple different amphp workers on the same core doing file_get_contents concurrently?
I am implementing AMPHP for multithreading, replacing an existing "multicurl callback" solution where new php processes were created by doing an external call to the server from within the ...
0
votes
1
answer
134
views
Do examples exist for returning data from an AMPHP future?
After reading the documentation for AMPHP I haven't been able to track down an example for returning results from a threaded process, however many examples for printing data from a thread exist. Are ...
0
votes
0
answers
60
views
Parcel (or analog) to exchange data between Parent and Child processes
I have a worker pool with some tasks running. Workers are using consumables they may request at any time - I wish to use Parcel for this purpose. Parcel is a very convenient way of communicating with ...
0
votes
1
answer
379
views
Parallel function call in php
Is there a way to execute internal functions in parallel in PHP?
For example, I have four functions:
function a(){
return 1;
}
function b(){
return 2;
}
function c(){
return 3;
}
...
0
votes
0
answers
82
views
How to continue performing asynchronous actions after return in php?
I'm just a beginner, please tell me if it is possible to return the result from a php function, but at the same time so that asynchronous actions continue to work in it using the amphp library?
...
0
votes
1
answer
325
views
Amphp parallel adding lots of amp-parallel sock files in php-fpm tmp folder
I am using the following code to submit workers into the queue and then run them with Task.
$executions = [];
foreach ($urls as $url) {
// FetchTask is just an example, you'll have to implement
...
0
votes
1
answer
193
views
Using Amphp with a framework such as Magento
I am trying to use Amphp Parallel functions with the Magento framework in a custom module.
try {
$response = wait(parallelMap($items, function ($item) use ($arg1){
$this->getCustomItems(...
1
vote
1
answer
2k
views
Do i really have to restart the server everytime i made changes?
i want to use AMP PHP and create a Project. So i started with one of the examples on github and i can see hello world.
Now if i make changes to my code, i have to restart everytime the server. but ...