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

Application ID incrementation Issue

oniaz
Retired

Hi All,

 

I currently have a macro which increments the App ID by 1 when a application is created.

 

This works correctly but where my problem is now arrising is when user A and User B
are logged into MEGA at the same time, which indicates that two separate repository snapshots at that
point of time are taken. 

Next user A creates a new application and dispatches the transaction. The application will be created
correctly with the correct Application ID, which is the last running number,
incremented by 1, for example, 8552, assuming the last running number is 8551. 

Then user B creates another application, and dispatches the transaction. The Application ID will be pre-fixed with 1, in this case, 1  8552. This is because it also remembers the same last running number, 8551, at the point where the transaction was created.

So in a nutshell, at any point of time, if one or more users log into the same repository, all the users
will have the same last running number of the Application ID (e.g. 8551).

Upon dispatching the Application ID will be pre-fixed accordingly, for example 1 8552, 2 8552
etc... for the new applications which users create.

This problem can be avoided in some case where the user will refresh the repository before carrying out changes but again this is dependant on the other users dispatching the changes they have made.

So what i want is for the App ID to automatically increment on dispatch instead of prefixing a number infront of the ID, whilst also recognising the App ID the other users have and then incrementing the id properly.

 

what would be the best method for achieving this result?

 

I hope all this makes sense.

 

 

Thank You,

 

Omar

 

2 Replies

Hi Jerome,

 

Thank you for the response. The only problem i see with this method is if a user decides to discard their changes then gaps will start to develop in the ID system.

 

thanks again for the advice.

 

Kind Regards,

 

Omar

jhorber
MEGA
MEGA

Hello Omar

 

As you know  with MEGA Desktop platform in version MEGA 2009, all concurrent connections are made in transaction mode. In this mode, no data is shared at any moment (public data).

The view of data is the view available when opening the transaction.

There is no automatic numbering system that would bypass the transaction mode.

 

Given this you can:

 

1) Keep you code and provide user guidance

Example:

  • Before creation of an application, refresh your transaction (to get the lastest public value of 'App ID')
  • After creation of an application, dispatch your transaction (to set the lastest public value of 'App ID')

 

2) Change your code

Example: save the latest public value in an external file.

  • Before creation of an application, check this file (to get the lastest public value of 'App ID')
  • After creation of an application, update this file (to set the lastest public value of 'App ID')
Jerome