Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Offline Case #36

Closed
neophob opened this issue Dec 4, 2015 · 9 comments
Closed

Handle Offline Case #36

neophob opened this issue Dec 4, 2015 · 9 comments
Assignees
Milestone

Comments

@neophob
Copy link

neophob commented Dec 4, 2015

I would like the (rare) case that when the user is offline, I don't want that the my application fails (blocks). One simple solution would be to add a timeout to the request:

src: https://gist.github.com/hale/5901734

return typeof callback === "function" ? callback(500, {
            error: {
              code: type,
              type: type,
              message: "An unexpected error has occurred with Stripe.js. This may\nbe due to network connectivity issues, so you should try\nagain (you won't be charged twice). If you're still having\nproblems, please let us know!"
            }
          }) : void 0;

what do you think?

Cheers

@ajbrown ajbrown added this to the 0.2.5 milestone Jun 6, 2016
@ajbrown ajbrown self-assigned this Jun 6, 2016
@ajbrown ajbrown modified the milestones: 1.0.0, 0.2.5 Jun 11, 2016
@icedice
Copy link

icedice commented Sep 8, 2016

Any news on this? Am using this nice wrapper in a Ionic/cordova app, my only problem is when the app is offline and a error occurs it will try to log to loggly and this fires another error which sends the app into a infinite loop and it eventually crashes. Is there anyway to disable and enable the logglyLogger at runtime? that way I would be able to disable it when "offline" event fires and enable when "online" event fires.

@ajbrown
Copy link
Owner

ajbrown commented Sep 9, 2016

@icedice Thanks for the info, I didn't realize how bad this really was. I was holding off on this feature for the next major release, but from the sound of it it's much more urgent. I'll throw something together here in the next couple of days.

@icedice
Copy link

icedice commented Sep 9, 2016

You don't need to hurry. I did a quick customisation of your (great) wrapper så it only tries to contact loggly if it is online. This means that I loose messages when the app is offline but this is not critical for me also it could be solved with some kind of cache which then sends it when it's back online. Anyways I still thing this would be a great feature en a future release.

@ajbrown
Copy link
Owner

ajbrown commented Sep 9, 2016

Would you mind opening a pull request for it? I'd love to see what you've
done.

On Fri, Sep 9, 2016 at 11:22 AM, Toke Refstrup notifications@github.com
wrote:

You don't need to hurry. I did a quick customisation of your (great)
wrapper så it only tries to contact loggly if it is online. This means that
I loose messages when the app is offline but this is not critical for me
also it could be solved with some kind of cache which then sends it when
it's back online. Anyways I still thing this would be a great feature en a
future release.


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
#36 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACWMvUHERfFsKVdmpY3LiqqIbYKJ4xdks5qoXmbgaJpZM4GvR72
.

A.J. Brown
@AdrianJBrown http://twitter.com/adrianjbrown on Twitter
http://ajbrown.org on The Web

@icedice
Copy link

icedice commented Sep 9, 2016

Sure, but it's just a really quick fix, basically I just surrounded the ajax call to loggly so it only gets called if we have net. I'm using Cordova network plugin if available otherwise I use navigator.onLine....

@corsa1r
Copy link

corsa1r commented May 12, 2017

If you don't catch http request fails they will be handled by loggly. In my case to prevent endless offline logs i have to add .catch(console.error) to $http.post that logger method uses to send logs.

//current version
//Ajax call to send data to logglyÎ
$http.post(buildUrl(), sentData, config);

//my fix
//Ajax call to send data to logglyÎ
$http.post(buildUrl(), sentData, config).catch(console.error);
`

@Cleod9
Copy link

Cleod9 commented Oct 11, 2018

I assume this project has likely kicked the bucket, but I wanted to point out how serious of an issue this is. I've confirmed that users who use uBlock Origin are likely heavily affected by this issue, because loggly is blocked before the request goes out. This mimics an "offline" effect, throwing the app into an infinite memory-consuming loop.

See uBlock's logs below:

image

See Firefox's Memory Usage as well:

image
(Same issue in Chrome though at least Chrome will abort the tab after a certain point)

If I didn't know any better I would have thought something malicious was going on 😬

@ajbrown
Copy link
Owner

ajbrown commented Oct 11, 2018

@Cleod9 thanks for kicking this back to my inbox. I just merged the PR for this in and will cut a new release here shortly.

@ajbrown ajbrown modified the milestones: 1.0.0, 0.3.2 Oct 11, 2018
@ajbrown
Copy link
Owner

ajbrown commented Oct 11, 2018

This has been fixed and released in 0.3.2

@ajbrown ajbrown closed this as completed Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants