Question
· Feb 20, 2018

How to avoid the process to get stuck in a Queue?

Hi!

We have problems in some productions where it stuck in a Queue when things goes wrong and i wonder if somebody have som tips to avoid it?

example when we got stuck is this:

set MyClass= ##class(SomeClass).%New(). MyClass has a Datefield

try
{
 
MyClass.Date =  Sourcedata.Date  //Sourcedata send us wrong format to that datefield. Error occur.

}

catch ex 
{
set tErrMsg = "Error i this method "  _ $System.Status.GetOneStatusText(ex.AsStatus())
$$$LOGERROR(tErrMsg)
Quit
}

In this case the catch-scope is not seems to be reached at all and the production get stuck in a Queue.

And this is pretty common for us also in operations if some request goes wrong.

Is there any common best practice to prevent or kill the queues?

Best regards,

Michael Lundberg

Discussion (5)1
Log in or sign up to continue

catch-scope is not seems to be reached

Have you enabled logging?

Error occurs on saving incorrect data and not on setting the data. Saving also does not throw an exception, only returns an error status.

Also you need to quit something:

#dim sc As %Status = $$$OK

try
{
  set myClass= ##class(SomeClass).%New()
  myClass.Date =  Sourcedata.Date  //Sourcedata send us wrong format to that datefield.
  set sc = myClass.%Save() // Error occurs on save.
} catch ex {
  set sc = ex.AsStatus()
  set errMsg = "Error in this method "  _ $System.Status.GetOneStatusText(sc)
  $$$LOGERROR(errMsg)
}
quit sc

On a side note, you're using 3 different naming conventions for variables in your snippet:

  • tHungarianNotation
  • CapitalCase
  • lowercase

It would probably be better to decide on one notation.