Machii Running event more than once.

14 views
Skip to first unread message

alex...@gmail.com

unread,
Apr 10, 2012, 9:54:22 AM4/10/12
to Mach-II for CFML
Excuse my ignorance.

I have an event which performs some logic and then inserts a record
into the database.

I have found that if users run that event more than once the data can
be added more than once.

How can I prevent this particular event from running concurrently.

I would like the event to be locked whilst an call to it is already
still being processed.

I realise this will also require me to lock the database in some way
but with regards to machii how do I got about it?

thanks

Matthew Woodward

unread,
Apr 10, 2012, 10:30:21 AM4/10/12
to mach-ii-for...@googlegroups.com
On Tue, Apr 10, 2012 at 6:54 AM, alex...@gmail.com <alex...@gmail.com> wrote:
I have found that if users run that event more than once the data can
be added more than once.

It sounds like you just need to use a redirect instead of a simple announce; that way the URL will change and they can't hit refresh to run the event again.

--
Matthew Woodward
ma...@mattwoodward.com
http://blog.mattwoodward.com
identi.ca / Twitter: @mpwoodward

Please do not send me proprietary file formats such as Word, PowerPoint, etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html

alex...@gmail.com

unread,
Apr 11, 2012, 5:41:07 AM4/11/12
to Mach-II for CFML
No sorry.. I know what you mean but they have a link they can click to
perform the action.

They can click the button at any time and on multiple occasions.

I would just like it to do nothing if the machii event is already
still running.

I am starting to think that this is not possible.

hmm

On Apr 10, 3:30 pm, Matthew Woodward <m...@mattwoodward.com> wrote:
> On Tue, Apr 10, 2012 at 6:54 AM, alext...@gmail.com <alext...@gmail.com>wrote:
>
> > I have found that if users run that event more than once the data can
> > be added more than once.
>
> It sounds like you just need to use a redirect instead of a simple
> announce; that way the URL will change and they can't hit refresh to run
> the event again.http://trac.mach-ii.com/machii/wiki/ConfigFileExplained#redirecthttp://trac.mach-ii.com/machii/wiki/MachII1.8Redirect
>
> --
> Matthew Woodward
> m...@mattwoodward.comhttp://blog.mattwoodward.com

alex...@gmail.com

unread,
Apr 11, 2012, 5:46:34 AM4/11/12
to Mach-II for CFML
I am now thinking that what I need is a plugin.

Since plugins can access the event preprocess and handleException
using plugin points I could mark an application var stating that the
process is running.

Then on completion or an error it is marked as not running.

seems a little complicated for what I want to do but can't think of
another way round it.

Matthew Woodward

unread,
Apr 11, 2012, 2:13:54 PM4/11/12
to mach-ii-for...@googlegroups.com
On Wed, Apr 11, 2012 at 2:46 AM, alex...@gmail.com <alex...@gmail.com> wrote:
I am now thinking that what I need is a plugin.

Well that or disable the link once they click it. Mach-II can't protect the application entirely from users doing stuff they're not supposed to. :-)
 

alex...@gmail.com

unread,
Apr 12, 2012, 3:05:27 AM4/12/12
to Mach-II for CFML
Thanks very much for your help :)

On Apr 11, 7:13 pm, Matthew Woodward <m...@mattwoodward.com> wrote:
> On Wed, Apr 11, 2012 at 2:46 AM, alext...@gmail.com <alext...@gmail.com>wrote:
>
> > I am now thinking that what I need is a plugin.
>
> Well that or disable the link once they click it. Mach-II can't protect the
> application entirely from users doing stuff they're not supposed to. :-)
>
> --
> Matthew Woodward
> m...@mattwoodward.comhttp://blog.mattwoodward.com
Reply all
Reply to author
Forward
0 new messages