Re: LOCKS???
| From: | Adam Jon Richardson | Date: | Tue, 29 Nov 2016 19:42:24 +0000 |
| Subject: | Re: LOCKS??? | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-325858@lists.php.net to get a copy of this message | ||
On Tue, Nov 29, 2016 at 2:09 PM, Stuart Dallas <stuart@3ft9.com> wrote:
> On 29 November 2016 at 16:51:24, Tedd Sperling (tedd.sperling@gmail.com)
> Ok, I’ve read lot, but I still cannot get a single example of LOCK to work.
>
> As mentioned I’m pretty sure this is because you’re attempting to lock in
> one request and expect the lock to still be there in subsequent requests.
> This is fundamentally not how MySQL table locks work so you’ll need to
> implement your own mechanism.
I agree with Stuart's analysis of failure causes and potential remedies. To
test the hypothesis that the share-nothing architecture of PHP is causing
the trouble, try adding a sleep() call to the first script and then within
the interval, call the second script. The tables should be locked.
Also, in terms of reads, I would suggest you could also provide a system
status update if a user is on a screen that is displaying data and the data
has changed, as you could prompt the user to refresh the page.
Happy coding!
Adam