You are here: Re: [PHP] Re: Getting the process ID « PHP « IT news, forums, messages
Re: [PHP] Re: Getting the process ID

Posted by trlists on 03/25/05 05:26

On 24 Mar 2005 Joshua Beall wrote:

> I realized that this sort of problem would always exist unless I had some
> sort of semaphore mechanism. Once a user has *started* a transaction, they
> need to be prevented from initiating a second transaction until the first
> transaction has been completed.

Why not simply store some kind of user ID and a timestamp for the
transaction start time in a database. Every time a new transaction is
started check the database, if there is another one in process, give an
appropriate error. When the transaction completes delete the record.

The hole in this of course is transactions that start and never finish.
That's why I suggest a timestamp -- you can use it to check how long
it's been since the previous transaction started, and ignore it if
that's over some threshold (for example, if the previous transaction
was stated a minute ago and a normal transaction takes 5 seconds, you
can be pretty sure). And you can run a cron job to periodically sweep
the database and remove old transactions that never completed.

--
Tom

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация