fire-and-forget | simple PHP library to just fire off an HTTP request | HTTP library
kandi X-RAY | fire-and-forget Summary
kandi X-RAY | fire-and-forget Summary
A simple PHP library to just fire off an HTTP request and forget about it
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Fire request .
- Get default port
- Get HTTP headers
- Register the Firestore .
- Returns a list of all providers .
- Get the facade accessor .
- Get the request s URL .
fire-and-forget Key Features
fire-and-forget Examples and Code Snippets
Community Discussions
Trending Discussions on fire-and-forget
QUESTION
I'm trying to create a lifetime process that batches incoming messages for DB bulk insert.
The new message is coming in 1 at a time, in an irregular interval.
My solution to this would be something like the producer-consumer pattern using BlockingCollection
.
Messages are added freely into the BlockingCollection
by various events and are taken out of BlockingCollection
in bulk for DB insert in regular intervals, 5 seconds.
However, the current solution is fire-and-forget. If the bulk insert failed for any reason, I need a way for the processor to notify the original sources of the failure, because the source contains the logic to recover and retry.
Is there a specific pattern I should be using for what I'm trying to achieve? Any suggestion or help is much appreciated!
...ANSWER
Answered 2022-Mar-19 at 12:59You will have to associate somehow each Message
with a dedicated TaskCompletionSource
. You might want to make the second a property of the first:
QUESTION
I am working on a p2p application and to make testing simple, I am currently using udp broadcast for the peer discovery in my local network. Each peer binds one udp socket to port 29292 of the ip address of each local network interface (discovered via GetAdaptersInfo
) and each socket periodically sends a packet to the broadcast address of its network interface/local address. The sockets are set to allow port reuse (via setsockopt
SO_REUSEADDR
), which enables me to run multiple peers on the same local machine without any conflicts. In this case there is only a single peer on the entire network though.
This all works perfectly fine (tested with 2 peers on 1 machine and 2 peers on 2 machines) UNTIL a network interface is disconnected. When deactivacting the network adapter of either my wifi or an USB-to-LAN adapter in the windows dialog, or just plugging the usb cable of the adapter, the next call to sendto
will fail with return code 10049
. It doesn't matter if the other adapter is still connected, or was at the beginning, it will fail. The only thing that doesn't make it fail is deactivating wifi through the fancy win10 dialog through the taskbar, but that isn't really a surprise because that doesn't deactivate or remove the adapter itself.
I initially thought that this makes sense because when the nic is gone, how should the system route the packet. But: The fact that the packet can't reach its target has absolutely nothing to do with the address itsself being invalid (which is what the error means), so I suspect I am missing something here. I was looking for any information I could use to detect this case and distinguish it from simply trying to sendto
INADDR_ANY
, but I couldn't find anything. I started to log every bit of information which I suspected could have changed, but its all the same on a successfull sendto
and the one that crashes (retrieved via getsockopt
):
ANSWER
Answered 2022-Mar-01 at 16:01This is a issue people have been facing up for a while , and people suggested to read the documentation provided by Microsoft on the following issue . "Btw , I don't know whether they are the same issues or not but the error thrown back the code are same, that's why I have attached a link for the same!!"
QUESTION
I am using the SelectMany
operator in order to project the elements of an observable sequence to tasks, and propagate the results of those tasks. Everything is OK if all operations succeed, but I don't like that in case of an exception all currently running operations are becoming fire-and-forget. I would prefer to wait until all pending operations have completed, and only then be notified for the error (or errors) that have occurred. Here is a minimal example of the behavior that I would like to avoid:
ANSWER
Answered 2022-Jan-31 at 13:15Here is one solution to this problem. The implementation below is based on the SelectMany
operator. All the involved observable sequences have their errors suppressed with a Catch
+Empty
combo. The errors are aggregated in a ConcurrentQueue
, and are thrown from a final Concat
+Defer
combo.
QUESTION
I have a simple Celery task.py
running with RabbitMQ message broker and Redis data storage
ANSWER
Answered 2021-Dec-31 at 06:28You have at least two options here:
- Use signals - task-postrun for instance:
QUESTION
I am trying to achieve a fire and forget type of effect with webflux, thymeleaf and r2dbc. I have two endpoints, one to add an employee and another to list all employees. I want to simulate a slow database access so I have a thread sleep of several seconds before I call the DB.
Now, the effect I expect to see when I call /add
is that my controller returns immediately and the page add
is rendered at once. However, I'm not sure how to achieve this. With the current code nap()
happens before I can return a Mono
. In other words, I'm trying to run a long running job in the background without blocking the controller.
I have the following model:
...ANSWER
Answered 2021-Nov-28 at 16:08I guess nap()
method executes Thread.sleep
or something similar, right? Thread.sleep
is blocking the main thread making the application unresponsive. You can use delayElements
operator to simulate a long-running operation:
QUESTION
As per David Karnok's classification 5th generation reactive frameworks are described as below
Reactive-Streams will need extensions to support reactive IO operations in the form of bi-directional sequences (or channels).
operator-fusion by David Karnok's
RSocket definition goes as below
RSocket is an application protocol providing Reactive Streams semantics over an asynchronous, binary boundary. It enables the following symmetric interaction models via async message passing over a single connection: request/response (stream of 1) request/stream (finite/infinite stream of many) fire-and-forget (no response) channel (bi-directional streams)
So Is RSocket a fifth generation reactive framework?
...ANSWER
Answered 2021-Nov-10 at 16:09Simply put, if you want to follow David Karnok's definition of what a fifth generation reactive framework would be, then the answer is yes:
RSocket extends the reactive semantics to the wire level making distributed systems aware of each others capacities and allowing to move the flow control, back pressure, and lease to the protocol level without any custom addition to remediate a situation where consumer cannot keep up with the pace of the produce such as buffering, throttling...
QUESTION
I have a Flux
stream. For each element processed I want to have an action triggered which is an asynchronous/non-blocking one. For example, a method returning back a Mono
from a db update.
I want this action to be done on the doOnNext
block.
I don't want to affect the Flux
, the processing and the back pressure implemented there.
Supposing Mono
method to be called is
ANSWER
Answered 2021-Nov-09 at 14:53dbUpdate()
will be ignored if you do not subscribe to it. The following snippet doesn't print anything because Mono.just("db update")
doesn't get subscribed.
QUESTION
Suppose a Prism version 8 WPF module has a ViewModel which needs to call on a service. the service implements IService, but there exists a number of implementations of this service. Each implementation is a file (class library), possibly as a IModule (see below).
The user shall be able to configure which file to use either by configuration or by a folder's content.
Obviously(?) I am thus thinking of Module discovery by creating the right type of ModuleCatalog while "bootstrapping" the application and the service could thus be contained in this module. If the call is a void call ("fire-and-forget") I guess I could simply use EventAggregator (implementing the service as an observer), however the call returns a value.
What is the best approach solving this? (I would like to avoid writing my own assembly "discovering/loading" of some kind of a swappable service implementation dll file)
...ANSWER
Answered 2021-Oct-17 at 20:47If you can inject IEventAggregator
, you can inject IService
, can't you?
If no module registered an implementation, you'll get an exception. If more than one module did, the last one wins (with unity as container, at least).
QUESTION
I have a lambda function where, after computation is finished, some calls are made to store metadata on S3 and DynamoDB.
The S3 upload step is the biggest bottleneck in the function, so I'm wondering if there is a way to "fire-and-forget" these calls so I don't have do wait for them before the function returns.
Currently I'm running all the upload calls in parallel using asyncio, but the boto3/S3 put_object
call is still a big bottle neck.
I tried using asyncio.create_task
to run coroutines without waiting for them to finish, but as expected, I get a bunch of Task was destroyed but it is pending!
errors and the uploads don't actually go through.
If there was a way to do this, we could save a lot on billing since as I said S3 is the biggest bottleneck. Is this possible or do I have to deal with the S3 upload times?
...ANSWER
Answered 2021-Sep-30 at 23:45If there was a way to do this,
Sadly there is not, unless you are going to use other lambda function to do the upload for you. This way your main function would delegate time consuming file processing and upload to a second function in an asynchronous way. Your main function can then return immediately to the caller, and the second function does that heavy work in the background.
Either way, you will have to pay for the first or second function's execution time.
QUESTION
I have a reactive pipeline to process incoming requests. For each request I need to call a business-relevant function (doSomeRelevantProcessing
).
After that is done, I need to notify some external service about what happened. That part of the pipeline should not increase the overall response time. Also, notifying this external system is not business critical: giving a quick response after the main part of the pipeline is finished is more important than making sure the notification is successful.
As far as I learned, the only way to run something in the background without slowing down the overall process is to subscribe to in directly in the pipeline, thus achieving a fire-and-forget mentality.
Is there a good alternative to subscribing inside the flatmap
?
I am a little worried about what might happen if notifying the external service takes longer than the original processing and a lot of requests are coming in at once. Could this lead to a memory exhaustion or the overall process to block?
ANSWER
Answered 2021-Sep-28 at 10:36I'm answering this assuming that you notify the external service using purely reactive mechanisms - i.e. you're not wrapping a blocking service. If you are then the answer would be different as you're bound by the size of your bounded elastic thread pool, which could quickly become overwhelmed if you have hundreds of requests a second incoming.
(Assuming you're using reactive mechanisms, then there's no need for .subscribeOn(Schedulers.boundedElastic())
as you give in your example, as that's not buying you anything - it's designed for wrapping legacy blocking services.)
Could this lead to a memory exhaustion
It's only a possibility in really extreme cases, the memory used by each individual request will be tiny. It's almost certainly not worth worrying about, if you start seeing memory issues here then you'll almost certainly be hit by other issues elsewhere.
That being said, I'd probably recommend adding .timeout(Duration.ofSeconds(5))
or similar before your inner subscribe method to make sure the requests are killed off after a while if they haven't worked for any reason - this will prevent them building up.
...or [can this cause] the overall process to block?
This one is easier - a short no, it can't.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install fire-and-forget
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page