Skip to content

Commit fb18add

Browse files
committed
Implement caching for business services in the Director class
1 parent 3211735 commit fb18add

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/iop/_director.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ class _Director():
1515
Instead these business services are created by a custom application by calling the Director.CreateBusinessService() method.
1616
"""
1717

18+
_bs = {}
19+
20+
def get_business_service(self,target):
21+
if target not in self._bs or self._bs[target] is None:
22+
self._bs[target] = _Director.create_python_business_service(target)
23+
return self._bs[target]
24+
1825
@staticmethod
1926
def CreateBusinessService(target):
2027
""" DEPRECATED : use create_business_service

src/iop/cls/IOP/Director.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Class IOP.Director [ Inheritance = right, ProcedureBlock, System = 4 ]
1010
ClassMethod dispatchCreateBusinessService(pTargetDispatchName As %String) As Ens.BusinessService
1111
{
1212
// Hack to prevent job to be registered in the production
13-
do ##class(Ens.Job).UnRegister(pTargetDispatchName,$JOB)
1413
set tSC = ##class(Ens.Director).CreateBusinessService(pTargetDispatchName,.service)
1514
if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
15+
do ##class(Ens.Job).UnRegister(pTargetDispatchName,$JOB)
1616
quit service
1717
}
1818

0 commit comments

Comments
 (0)