Best coding scheme for emailing error message

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

Cervisiae Amatorem
Posts: 57
Joined: Mon Aug 29, 2011 5:47 pm UTC

Best coding scheme for emailing error message

Postby Cervisiae Amatorem » Thu Jan 07, 2016 8:04 pm UTC

This is a dot net web app, where on a minor error it emails the team. It's not fatal or halting, just interesting. But I'm getting hundreds of emails a day and I need to fix that. It coded several different ways elsewhere in the code that all look clunky and kludgy, and I can't remember the "right" way to do it.

Here's what I need to do:

Code: Select all

                ' check for LastWebsiteStatusUnknown session variable
                ' if not present, send email, set LastWebsiteStatusUnknown session variable = Date.Now
                ' if LastWebsiteStatusUnknown > 1 day ago, send email, set LastWebsiteStatusUnknown session variable = Date.Now


What's the best practice for this?

Cervisiae Amatorem
Posts: 57
Joined: Mon Aug 29, 2011 5:47 pm UTC

Re: Best coding scheme for emailing error message

Postby Cervisiae Amatorem » Fri Jan 08, 2016 11:51 pm UTC

Anyone?

User avatar
Xanthir
My HERO!!!
Posts: 5311
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: Best coding scheme for emailing error message

Postby Xanthir » Sat Jan 09, 2016 1:23 am UTC

I'm not sure what you're actually asking for?
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

DaveInsurgent
Posts: 207
Joined: Thu May 19, 2011 4:28 pm UTC
Location: Waterloo, Ontario

Re: Best coding scheme for emailing error message

Postby DaveInsurgent » Sat Jan 09, 2016 4:42 pm UTC

I think the technique you're looking for is usually called a 'debounce' - basically, you have something that you want done when something happens, but only once every so often. Then, there's usually a leading or trailing debounce, so for example you might want to prevent double accidental clicks with a leading-edge debounce of 800ms. So the second the first click happens, it triggers the button, but a quick follow up click does nothing.

So you're looking to debounce your alert emails by 1 day. However, most systems for this kind of info would resort to a 'digest' where it aggregates the events and sends them. The kind of code you posted seems like it would drop information.


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 6 guests