I think the code speaks for itself. The sheer wtfness of this simple method is mind-blowing. The useless comments. The fact that a webservice exists to to a Thread.Sleep
. The fact that it returns a boolean (for what?). The catching of exception, in case a Thread.Sleep
has crashed I guess. The empty Finally
block. The fact that it's VB. Everything.
''' <summary>
''' Application service get delay of particular time based on the configuration settings "SleepTimeOut".
''' </summary>
''' <param name="userId">The user id.</param>
''' <param name="mandantId">The mandant id.</param>
''' <param name="userType">Type of the user.</param>
''' <returns><c>true</c> if success, <c>false</c> otherwise</returns>
<WebMethod()> _
Public Function ThreadSleep(ByVal userId As String, ByVal mandantId As String, ByVal userType As String) As Boolean
Me.WriteLog("Control entered in ThreadSleep()", "userId", userId, "mandantId", mandantId, "userType", userType)
Try
Dim sleepTimeOut As Integer
sleepTimeOut = IIf(Integer.TryParse(ConfigurationManager.AppSettings("SleepTimeOut"), sleepTimeOut), sleepTimeOut, 10000)
Thread.Sleep(sleepTimeOut)
Return True
Catch ex As Exception
Me.WriteLog(ex.ToString())
Return False
Finally
End Try
End Function