cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Macro to delete locks on dispatch

sgonthey
Super Contributor

hi,

 

I add a macro on dispatch to kill all the locks after the user's commit is OK .

the  macro begin  after  the dispatch ==> it's OK 

I've got this message , I don't know why ...  If someone can help me !  Thanks a lot !

Sandrine

 

Script error "Error(0x800a01b6) : this object do not  have this property or this méthod : 'myEnv.Databases'" at Line 24 :

 

Here is my code : 

 

Sub RunJobAfterDispatch(Root,Parameter)

 

'on dispatch success
Root.MegaCommit

 

'Destroy lock
Dim myBase,myEnv

Set myEnv = Root.CurrentEnvironment

Set myBase = myEnv.Databases.Item("mabase")

myBase.LockPurge "Action=Destroy,Scope=User"

 

End Sub

 

2 Replies

sgonthey
Super Contributor

Thanks Jérôme for your response, and sorry , I didn't know it wasn't a good idea

 

My first solution was an administration script deleting all the locks ones a week , for all the users

 

is it a better way ? 

 

Thanks

 

Sandrine

jhorber
MEGA
MEGA

Hello sGonthey

 

I understand you meet problems with lock but I really think it is not a good idea to develop such a code

 

Management of lock is a reponsibility of the system

Purge of useless locks can be an administration task.

 

To purge useless locks, use a batch processsing with administration API and not a dispatch job

 

You seem to assume that you can delete all the locks created by a user X in a private workspaces (transaction) W1

Do not forget that in the standard lock management, locks can persist (in unlocked state) after dispatch of W1 if other users work in private workspaces opened before dispatch of W1

 

Note that transaction is called private workspaces from HOPEX versions.

Jerome