mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-28 01:25:52 +03:00
[GH-ISSUE #1466] [Scripting] - onResponse Delay #1457
Labels
No labels
Discussion
Feature request
In Progress...
Plugins
Waiting response
Windows
Windows
bug
duplicate
enhancement
feature
good first issue
iOS
macOS 10.11
question
wontfix
✅ Done
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Proxyman#1457
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @michael-elkabetz on GitHub (Dec 12, 2022).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1466
Description
We have noticed that "onResponse" method is being called after short delay when using local proxy server.
There are any performance improvements planned for the upcoming future?
Thanks a lot for an amazing product!
Mike.
@NghiaTranUIT commented on GitHub (Dec 13, 2022):
Hey @whyike, if you notice the delay in the
onResponse, can you share with me a few information:await async? If you only use sync func, you might remove theasync.For example:
to
onResponsefunction heavy-computation?@michael-elkabetz commented on GitHub (Dec 13, 2022):
Hey @NghiaTranUIT,
First of all, thanks for the prompt response!!! really appreciate it!
No heavy-computation, however,
awaitis mandatory because i'm getting a JSON from the response, extract some data and i'm triggering another REST call using$http.put(URL, param);.Any other suggestions how can i improve or optimize the operation are welcome :).
Thank you champ!
Mike.
@NghiaTranUIT commented on GitHub (Dec 13, 2022):
So it's a reason, you make a REST call, so it takes time.
To improve the performance, please improve your endpoint, so it returns the response faster.
In terms of Proxyman app, we could not do it since it depends on the external networking calls, which is your API.
If the REST API response doesn't change, you might cache it on your Desktop, then read the file.
Ref: https://docs.proxyman.io/scripting/snippet-code#map-a-local-file-to-responses-body-like-map-local-tool-proxyman-2.25.0+
@michael-elkabetz commented on GitHub (Dec 13, 2022):
Thanks again for the quick response, you are truly amazing!
Just to make sure, are you suggesting to save the response on disk and read it from disk afterwords, is it will be quicker than read directly from the response object?
here is my snippet, just to be aligned.
Thanks,
Mike
@NghiaTranUIT commented on GitHub (Dec 13, 2022):
Yes, it's definitely faster.
The problem is this line:
It will call an external network, which is slow.
By not using this line, and read from the file, it will improve the performance 👍
Here is the step:
@michael-elkabetz commented on GitHub (Dec 13, 2022):
Got it dear, however we can't read the response for disk because we have to update an external service when onResponse called.
so there are no more performance improvements that we can add here right?
@NghiaTranUIT commented on GitHub (Dec 13, 2022):
So, there is only 1 solution. Make your Backend faster, so the REST API will be faster.