Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7531737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:15:13+00:00 2026-05-30T05:15:13+00:00

I would like to hook into this question, however perhaps rephrase it from a

  • 0

I would like to hook into this question, however perhaps rephrase it from a different angle.

For anti fraud purposes I would like to block visitors after a certain amount of incorrect login attempts. At this point I have a manager class which wraps the actual function call to login. The manager throws an exception if a visitor is blocked and thus the actual login method is never called. So far so good.

I would now like to change the exception throwing part to a Thread.Sleep kind of thingy. This is not an option however because this will block other requests to the server. Is there an easy alternative for this scenario perhaps using some async wait command or perhaps using F#?

Current code:

class Manager {
    void Execute(Action action) {
        if(user.IsBlocked)
            throw new BlockedException();
        else
            action();
    }
}

Preferred code:

class Manager {
    void Execute(Action action) {
        if(user.IsBlocked)
            //Wait for xxx minutes


        action();
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:15:14+00:00Added an answer on May 30, 2026 at 5:15 am

    Doing it this way would eat resources really quickly. You don’t want multiple threads on your server (possibly dozens depending on the amount of visitors and the duration of your block) busy waiting until you can finaly send your response. Besides, it will not be clear to the visitor what is happening; it will seem as if your server is just not responding (which is true).
    A better way is to just keep throwing the exception and maybe handle it more gracefully. For instance using javascript to display a countdown on the client until the time you may try again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to hook into the Node constructor function. Is it possible to
I am using TortoiseHg and would like to apply a hook to my repo.
I'm writing a pre-commit hook, and would like to do a check on the
Would like to be able to set colors of headings and such, different font
In my post-receive hook, I would like to get the branch the user is
This seems like a fundamentally simple question. I have a WinForms dialog box with
I would like to additional instructions to a custom Drupal form, similar to hook_help,
Would like to get a list of advantages and disadvantages of using Stored Procedures.
Would like to create a strong password in C++. Any suggestions? I assume it
Would like to know what a programmer should know to become a good at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.