This project has moved. For the latest updates, please go here.

Bug in Scheduling SFTP receive

Aug 2, 2010 at 1:18 PM
Mikael, We have discovered that the SFTP receive always does a poll when the port is started (either when the host is recycled or when the service window is activated) instead of waiting for the day/time of the poll defined in the port. Is there a way to stop this initial poll? We can disable the service window but the reason we put that in place was because when we patch and reboot the servers on Sunday, they poll when we don't want the poll until Monday (as defined in the schedule of the receive port). Thanks! John
Coordinator
Aug 5, 2010 at 6:49 AM
Hi John, There is not much I can do about the behavior of the ScheduledTask unfortunately. However, one could solve it by always ignoring the first poll. I will think of implementing this, and if I do it will be an optional "feature" as I don't believe this is always expected. If you want to implement it yourself, it a pretty easy thing to do: 1. Download the source code: http://sftpadapter.codeplex.com/releases/19784/download/140413 2. In the SftpReceiverEndpoint class, create a local bool variable called _isFirstPoll. bool _isFirstPoll = true; 3. Update the ControlledEndpointTask method which is called from ScheduledTask, and just exit the method if _isFirstPoll == true. public void ControlledEndpointTask() { //This is your code! if (this._isFirstPoll) { this._isFirstPoll = false; return; } if (this._controlledTermination.Enter()) { TraceMessage("[SftpReceiverEndpoint] ControlledTermination.Enter()"); try { lock (this) { this.EndpointTask(); } GC.Collect(); } finally { TraceMessage("[SftpReceiverEndpoint] ControlledTermination.Leave()"); this._controlledTermination.Leave(); } } } Let me know if you need any help. If it's urgent, contact me through IM on my blog (http://blogical.se/blogs/mikael) HTH //Mikael
Coordinator
Aug 5, 2010 at 6:49 AM
Sorry about the formating btw...