Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Lapse in Window Service

Lapse in Window Service

Scheduled Pinned Locked Moved C#
help
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 781610
    wrote on last edited by
    #1

    Hi, Recently I have launched a service and it is working fine. The problem now is it lapses a second for every 2 days. :sigh: Is there any workaround to solve this. Can any one advise me on this.

    Long Live

    P M 2 Replies Last reply
    0
    • M Member 781610

      Hi, Recently I have launched a service and it is working fine. The problem now is it lapses a second for every 2 days. :sigh: Is there any workaround to solve this. Can any one advise me on this.

      Long Live

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      What do you mean? What lapses a second? What processing is going on? Without this information, I wouldn't even begin to know where to look.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      1 Reply Last reply
      0
      • M Member 781610

        Hi, Recently I have launched a service and it is working fine. The problem now is it lapses a second for every 2 days. :sigh: Is there any workaround to solve this. Can any one advise me on this.

        Long Live

        M Offline
        M Offline
        Member 781610
        wrote on last edited by
        #3

        Hi thanks for you reply. The service generates a file on a daily basis at a specified time range mentioned in the app config file. For this purpose the service will make a check the current time against the one in config file for every 5 mins. This part works fine. The problem is for example if it check by 12:34:33 pm the next check is performed exactly at 12:39:33 PM. But in course of time say a day or two the checking drifts from 12:34:33 PM to 12:34:34 PM. Like this with in a month the polling time chages to 12:35:XX PM. I wish to put a check on this. B'coz if the file generation time range is between 12:33:00 PM 12:36:00 PM in course of time the service may run without generating the file. Thanx and Rgds,

        Long Live

        V P 2 Replies Last reply
        0
        • M Member 781610

          Hi thanks for you reply. The service generates a file on a daily basis at a specified time range mentioned in the app config file. For this purpose the service will make a check the current time against the one in config file for every 5 mins. This part works fine. The problem is for example if it check by 12:34:33 pm the next check is performed exactly at 12:39:33 PM. But in course of time say a day or two the checking drifts from 12:34:33 PM to 12:34:34 PM. Like this with in a month the polling time chages to 12:35:XX PM. I wish to put a check on this. B'coz if the file generation time range is between 12:33:00 PM 12:36:00 PM in course of time the service may run without generating the file. Thanx and Rgds,

          Long Live

          V Offline
          V Offline
          Vikram A Punathambekar
          wrote on last edited by
          #4

          Without looking at the code, how do you expect us to help you? *If* you are using Thread.Sleep(5 * 1000), then it will not be correct because the actual processing work takes up some time. Use a Timer instead.

          Cheers, Vikram.


          "If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy

          1 Reply Last reply
          0
          • M Member 781610

            Hi thanks for you reply. The service generates a file on a daily basis at a specified time range mentioned in the app config file. For this purpose the service will make a check the current time against the one in config file for every 5 mins. This part works fine. The problem is for example if it check by 12:34:33 pm the next check is performed exactly at 12:39:33 PM. But in course of time say a day or two the checking drifts from 12:34:33 PM to 12:34:34 PM. Like this with in a month the polling time chages to 12:35:XX PM. I wish to put a check on this. B'coz if the file generation time range is between 12:33:00 PM 12:36:00 PM in course of time the service may run without generating the file. Thanx and Rgds,

            Long Live

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            I suspect that what you are seeing is simply the result of an operation taking time to complete, and the timer that is doing the polling is gradually slipping as a result.

            Deja View - the feeling that you've seen this post before.

            My blog | My articles

            M 1 Reply Last reply
            0
            • P Pete OHanlon

              I suspect that what you are seeing is simply the result of an operation taking time to complete, and the timer that is doing the polling is gradually slipping as a result.

              Deja View - the feeling that you've seen this post before.

              My blog | My articles

              M Offline
              M Offline
              Member 781610
              wrote on last edited by
              #6

              This is how i coded. lDueTime = 60000; lPeriod = 300000; TimerCallback timerDelegate = new TimerCallback(FileOperations); ThreadTimer = new Timer(timerDelegate, null, lDueTime, lPeriod); public void FileOperations() { // My code goes here }

              Long Live

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups