Comments (14)
We should also implement this (for browsers that support it, which is just chrome at the moment): https://wicg.github.io/BackgroundSync/spec/
from exceptionless.javascript.
Having looked at the code i've now used the useLocalStorage setting to use window.localStorage, however this is still not working as expected.
When an error is thrown it is enqueued, i then navigate away from the page before the queue is processed (to another page within my application). On this new page the processing queue is never started meaning the previous error is now setting in localStorage but is not being sent, this is up until a new error occurs at which point all errors in localStorage are picked up.
Is there further configuration required by me to fix this? Or is this a bug and the 'Processing queue...' event should fire regardless of if there has been an error or not?
from exceptionless.javascript.
A solution to this could be to update the DefaultEventQueue constructor to start the queue timer straight away, line 1531 of exceptionless.js.
function DefaultEventQueue(config) {
this._handlers = [];
this._processingQueue = false;
this._config = config;
this.ensureQueueTimer(); /// Add this?
}
from exceptionless.javascript.
we'll I think we should look into firing an event to process the queue when the browser tab changes / on page leave. Ideally it would be nice to be able to sleep the client during this period too. You may not want to fire the queue timer on launch as the config might not be set. What are your thoughts?
from exceptionless.javascript.
Having it respond to browser tab change or page leave would be great, the 'unload' event could be used here to prompt the queue to process one last time, however it looks like the actions that cause this event to fire can differ between browsers (i.e. - some versions of Firefox don't trigger the event when the window is closed), if this sort of change was made it would have to be heavily cross-browser tested.
I still feel that the processing queue should be started on page load to allow any exceptions stored within localStorage to be sent, perhaps instead of within the constructor the processing queue should be started when the config has been loaded in the 'getSettings' or 'updateSettings' methods?
The root of the issue is down to the queue only being processed once every 10 seconds, is this something that could be called more often? Looking at the code very little processing is done if there is nothing waiting in the queue so i doubt this running more frequently would cause any performance issues.
from exceptionless.javascript.
I was talking to @srijken about wiring up to the onbeforeunload and unload events and calling processqueue but ensure it does a sync send (http://stackoverflow.com/questions/4945932/window-onbeforeunload-ajax-request-problem-with-chrome). This should help with this. Also we need to investigate and see if window.onload if the app is fully configured at this stage. if it is we could process the queue (if there are any items).
The problem with just calling it when the client is loading up is you can block other apps from making requests as well as the fact you may want to configure the client (thus you can't just fire it off from the constructor as it's hit when the object is created).
from exceptionless.javascript.
There is a fine line here on startup costs, we need to come to a consensus on whats appropriate. Should we look into events that are cross browser and fire when page is idle (we trigger it after the page is all updated and idle)?
from exceptionless.javascript.
@jdtaylor91 would you mind looking into how we could accomplish processing the queue on startup.
from exceptionless.javascript.
@niemyjski I've had a quick look and believe the simplest solution would be to start the processing queue after the config has been loaded, this would avoid the issue of it starting straight away and would allow any configuration changes to take effect.
On a side note, would it be possible to add a new setting to allow us to specify if we want to use the processing queue or not? By default it could be set to true so that the queue can be used, but when set to false it would result in the error being logged to exceptionless as soon as it is submitted.
from exceptionless.javascript.
I think the first is acceptable and also look into looking into the unload and unloading events.
If anything I think that a proposal to pause the queue and start queue processing could be a separate issue. It might be nice to have something like that so everything is suspended while a tab / js app sleeps.
from exceptionless.javascript.
Yeah, that might be good, we'd have to check for the existence of fetch and that api. I wonder if there is a legacy way to do sync xhr.
from exceptionless.javascript.
Has there been any progress on this?
from exceptionless.javascript.
So by default we now use local storage so events are always persisted. However I haven’t found any event that fires when you navigate away (I sis haven’t really looked in a long while) sovthe wueue won’t be processed until next visit. Can you please look into seeing if there is an event that covers this scenario that we can wire up to?
from exceptionless.javascript.
We handle this much better in the 2.0 client. We automatically use local storage and we listen to browser events for unloading and we call process queue. Please let us know how this is working out for you.
from exceptionless.javascript.
Related Issues (20)
- Include option to pass in fallback UI component into ExceptionlessErrorBoundary HOT 3
- Can't Use exceptionless/react on Next.js project HOT 4
- Feature Request: Add CJS Support HOT 14
- Error reported in vite3. x HOT 2
- Using ExceptionlessClient causes Node script not to exit HOT 5
- Using Exceptionless for nodejs causes problems with AWS Lambda functions HOT 7
- Update docs to showcase session tracking and es6 syntax
- Repeat send options HTTP method HOT 1
- Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. HOT 6
- Breadcrumbs HOT 3
- url parse is wrong HOT 5
- How to disable global exception handling HOT 6
- Where i can find the log HOT 4
- TypeError: (void 0) is not a function HOT 8
- make submitSessionEnd identity parameter optional and look up the user identity. HOT 1
- npm git error with 1.6.2 HOT 1
- this package couldn't work on React Native app HOT 9
- Recommended CDN is end of life HOT 3
- Import/Require From dist folder is confusing HOT 1
- Testing New JavaScript Workspaces Packages HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exceptionless.javascript.