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 3959940
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:47:33+00:00 2026-05-20T02:47:33+00:00

I have an application that is a data poller/updater and there are tons of

  • 0

I have an application that is a data poller/updater and there are tons of If/Thens around whether it’s a certain time on the clock.

In other words, this program runs from the scheduler on multiple schedules, each time passing an operation argument. From there the first check is a check of the current hour and minute and from that the program decides whether this is the right time to run the data poller.

Now you might wonder why if I run on a schedule then do I care about what time of day it is, why not just run at every interval? Well the data source in this case is from a different group in my company and they have a governor on the number of hits it’ll take. They can’t be reasoned with either, so I limit the number of hits I make to those that have a good chance of returning data.

So back to the problem, in most cases I am after a set of data that’s updated at the source once a day. Currently I run on like a 5 minute interval, but only go looking for new data when it’s after 8 PM.

My question is, I have all these nasty if/then statements that compare the current time to a set value, which then always leads me to think that I should make them runtime configurable, which leads to configuration code and in the end I have a rats nest of code.

Is there any better pattern that I am not thinking of, or some type of package that’s built for problems like this?

  • 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-20T02:47:34+00:00Added an answer on May 20, 2026 at 2:47 am

    Here is something that I have used:

    A Schedule object with the Task to do and a Time to do it (or a list of times to do it).

    Collect all your tasks in a list, and read through this list every five minutes, to check whether some of them should be run.

    This should reduce the If/then statements, and also make it much easier to unit test.

    Hope this helps
    /Morten

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

Sidebar

Related Questions

I have an application that imports data from a pickled file. It works just
We have an application that generates simulated data for one of our services for
I have created an application that writes some data to the root folder of
We have an application that will be collecting data and storing it in local
I have an application that reads a CSV file with piles of data rows.
I have client application that uses WCF service to insert some data to backend
I have a XULRunner application that needs to copy image data to the clipboard.
I have a C++ application with data that needs to be shared with a
I have a winform application that uses some referenced web services to get data.
I have a Dynamic Data Entities Web Application that uses a database with GUIDs

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.