timing assistance

Need some help with my logic here - just want to make sure I'm not overlooking anything...

I have a service that when it's first launched (or more precisely 10 seconds later), it begins testing for the presence of a file.
If the file exists, it begins the copy and extraction process, which takes about 10-15 minutes (the file will vary slightly on a daily basis, so this is a rough range).
If the file isn't there, the test occurs (setting the timer interval) every 10 minutes until it is there.

Sadly, the file is never created at the same point - it varies by an hour or two (or more - and possibly not at all).

Once the copy process is successful, I set the timer interval to 20 hours to await the next generation, at which point the timer is then set to 10 minutes until it's found again.

Lastly, if the timer tick ever occurs on a weekend day, I reset the interval to 24 hours and wait until the following business day to try again.

That said, I'd like some suggestions/corrections in case I've set this up incorrectly...here's the sub:
Shared Sub tmr_Tick(ByVal source As Object, ByVal e As Timers.ElapsedEventArgs)
  If blnCopyInProgress Then
    Exit Sub
  Else
    Select Case Today.DayOfWeek
      Case DayOfWeek.Saturday Or DayOfWeek.Sunday
      tmr.Interval = 86400000 'delay 24 hours
      Exit Sub
    Case Else
      'other logging code here
    End Select
  End If
 
  If tmr.Interval <> 600000 Then tmr.Interval = 600000
 
  If File.Exists(strSrcFile) Then
    CopyData()
    tmr.Interval = 72000000 ' wait 20 hours before trying again
  End If
End Sub

Open in new window

LVL 67
sirbountyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SanclerCommented:
Looks good to me - although, obviously ;-), not tested

Roger
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jorge PaulinoIT Pro/DeveloperCommented:
It seams Ok for me (except the copydata that we don't see it)

It's normally a good practice to stop the timer in the beggining of the rotine (enable = false) and enable it again in the end, but in here seams not critical.

jpaulino

PS: Also not tested
0
sirbountyAuthor Commented:
Haha - thanx guys.
:^)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.