Vannak a Drupalnak amolyan rejtett dolgai, az ember ritkán találkozik velük, sőt, esetleg nem is tudjuk, hogy létezik. Na egy ilyet szedek elő, bevallom, én is ma találkoztam vele először. Ez pedig a locking system, magyarul talán zárolási rendszer a randa szó rá, de becézhetjük szemafornak is.
De mit is csinál ez? Vannak a drupalban olyan folyamatok, amikből nem árt, hogyha nem indul el ugyanazon paraméterekkel kettő. Tipikusan ilyen drupal folyamat a cron, illetve a batch.
Biztosan találkoztál már olyannal a naplóban, hogy "Attempting to re-run cron while it is already running.", magyarul ilyesmi, hogy a "Cron futása nem lehetséges, mert már fut".
Ilyenkor az történik, hogy a hogy amikor elindul egy cron folyamat, egy zárolási rekord keletkezik a semaphore táblában. Ez a lock_acquire($name) függvány hívására történik. Amikor cron futás közben újabb cron indul, történik egy ellenőrzés, hogy a 'cron' nevű zárolás létezik-e már, és ha igen, akkor nem indul el az újabb cron, illetve akkor keletkezik a naplóban az emlegetett bejegyzés.
A lock státuszát mi is lekérdezhetjük: lock_may_be_available('cron').
Amikor az első cron véget ért, akkor történik a zárolás feloldása a lock_release('cron') függvény hívásával.
Mire jó ez még a gyakorlatban?
Nem néztem meg, de például a views is igen valószínű, hogy ez alapján zárolja a nézetek szerkesztési felületét. Ilyenkor van az, hogy "A nézet nem szerkeszthető, mert egy másik felhasználó zárolta", vagy valami ilyesmi..
Van egy éppen aktuális téma a drupal.hu-n, a kolléga egy másik adatbázist írna drupal felületen keresztül. Nos, én bizony preventív nem biztos, hogy szívesen hagynám, hogy egyszerre többen ugyanazt a rekordot szerkesszék. Tehát a szerkesztő form generálása során csinálnék egy lock_acquire("mylock_$recordid"); -t, a form beküldése után pedig lock_release("mylock_$recordid").
És aminek a kapcsán én találkoztam ma a locking system-el, az a boost modul. Észrevettem, hogy ha kell, ha nem, törlődnek a boost által létrehozott oldalak minden cron futáskor. Ennek az oka pedig a locking system "nem ismerete" volt. A modul fejlesztője egy egészen más vonalon oldotta meg a dolgot, ami sok esetben nem működik.
Az eset másik tanulsága: Hogy sokféleképpen meg lehet oldani egy feladatot, de ha azt nem "drupalosan" teszed, akkor bizony érhetnek meglepetések.
Hozzászólások
Hi there, all is going nicely
Hi there, all is going nicely here and ofcourse every one is sharing data, that's actually fine, keep up writing.|
My spouse and I stumbled
My spouse and I stumbled over here by a different web address and thought I might check things out. I like what I see so i am just following you. Look forward to finding out about your web page yet again.|
Every weekend i used to pay a
Every weekend i used to pay a visit this web site, as i want enjoyment, since this this site conations really nice funny material too.|
Your mode of describing all
Your mode of describing all in this paragraph is genuinely fastidious, all be able to effortlessly understand it, Thanks a lot.|
Excellent blog you've got
Excellent blog you've got here.. It's hard to find excellent writing like yours nowadays. I seriously appreciate individuals like you! Take care!!|
Do you have a spam problem on
Do you have a spam problem on this blog; I also am a blogger, and I was wanting to know your situation; many of us have developed some nice methods and we are looking to trade strategies with others, why not shoot me an email if interested.|
Appreciate this post. Will
Appreciate this post. Will try it out.|
I have read so many posts on
I have read so many posts on the topic of the blogger lovers but this post is really a fastidious paragraph, keep it up.|
I love reading through an
I love reading through an article that will make people think. Also, thank you for allowing me to comment!|
I've been exploring for a bit
I've been exploring for a bit for any high quality articles or blog posts in this kind of space . Exploring in Yahoo I ultimately stumbled upon this web site. Reading this information So i am glad to show that I have a very good uncanny feeling I discovered just what I needed. I most unquestionably will make certain to don?t omit this website and give it a glance regularly.|
Why visitors still use to
Why visitors still use to read news papers when in this technological globe all is accessible on net?|
This piece of writing
This piece of writing provides clear idea in support of the new users of blogging, that in fact how to do blogging.|
Woah! I'm really digging the
Woah! I'm really digging the template/theme of
this website. It's simple, yet effective. A lot of times it's hard to get that "perfect balance" between user friendliness
and visual appearance. I must say you have done a great
job with this. Additionally, the blog loads super
quick for me on Internet explorer. Outstanding Blog!
Hi there friends, how is all,
Hi there friends, how is all, and what you desire to say regarding this paragraph, in my view its truly awesome designed for me.|
I think everything posted
I think everything posted made a ton of sense. But, what about this? suppose you composed a catchier post title? I am not saying your content is not solid, but what if you added something that grabbed people's attention? I mean %BLOG_TITLE% is a little vanilla. You could look at Yahoo's front page and note how they create article headlines to grab people interested. You might try adding a video or a pic or two to grab people excited about everything've written. In my opinion, it would bring your posts a little bit more interesting.|
Heya i am for the first time
Heya i am for the first time here. I came across this board and I find It really useful & it helped me out much. I hope to give something back and aid others like you aided me.|
Howdy very nice blog!! Man ..
Howdy very nice blog!! Man .. Beautiful .. Amazing .. I'll bookmark your web site and take the feeds additionally? I'm satisfied to find a lot of useful info right here within the submit, we want work out more strategies on this regard, thank you for sharing. . . . . .|
Undeniably believe that which
Undeniably believe that which you stated. Your favorite reason appeared to be on the internet the easiest thing to be aware of. I say to you, I definitely get annoyed while people think about worries that they plainly don't know about. You managed to hit the nail upon the top and defined out the whole thing without having side-effects , people could take a signal. Will likely be back to get more. Thanks|
Great weblog right here!
Great weblog right here! Additionally your web site a lot up fast! What host are you the usage of? Can I get your affiliate hyperlink on your host? I wish my web site loaded up as quickly as yours lol|
I would like to thank you for
I would like to thank you for the efforts you've put in writing this blog. I am hoping to see the same high-grade blog posts from you later on as well. In truth, your creative writing abilities has inspired me to get my own, personal site now ;)|
My spouse and I stumbled
My spouse and I stumbled over here coming from a different web page
and thought I might check things out. I like what I see
so now i'm following you. Look forward to exploring your web page for a second time.
It's an awesome article in
It's an awesome article in support of all the internet viewers; they will obtain benefit from it I am sure.|
I know this if off topic but
I know this if off topic but I'm looking into starting my
own blog and was curious what all is needed to get set up?
I'm assuming having a blog like yours would cost a pretty penny?
I'm not very web savvy so I'm not 100% certain. Any recommendations or advice would
be greatly appreciated. Many thanks
It's going to be ending of
It's going to be ending of mine day, but before ending I am reading this impressive post to increase my experience.|
I got this website from my
I got this website from my pal who informed me regarding this web page
and now this time I am visiting this web site and reading very informative articles or reviews
at this time.
Thanks for one's marvelous
Thanks for one's marvelous posting! I definitely enjoyed reading it, you are a great author.I will always bookmark your blog and will come back down the road. I want to encourage you to definitely continue your great posts, have a nice day!|
Today, I went to the
Today, I went to the beachfront with my children. I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is totally off topic but I had to tell someone!|
This is my first time visit
This is my first time visit at here and i am in fact happy to read all at one place.
Wonderful article! This is
Wonderful article! This is the type of information that are supposed to be shared across the internet. Disgrace on the search engines for no longer positioning this put up upper! Come on over and visit my site . Thank you =)|
Right away I am going away to
Right away I am going away to do my breakfast, after having my breakfast coming over again to read additional news.
This post offers clear idea
This post offers clear idea in support of the new users of blogging,
that genuinely how to do blogging.
hi!,I like your writing very
hi!,I like your writing very much! proportion we be in contact more about your post on AOL? I need a specialist on this space to resolve my problem. May be that is you! Looking ahead to look you. |
Good post. I definitely love
Good post. I definitely love this site. Keep writing!
Asking questions are truly
Asking questions are truly fastidious thing if you are not understanding anything completely, however this post offers good understanding yet.|
A motivating discussion is
A motivating discussion is worth comment.
I do think that you ought to publish more about this subject matter, it may not
be a taboo matter but usually people don't speak about these subjects.
To the next! Kind regards!!
Informative article, just
Informative article, just what I needed.
Amazing! Its really awesome
Amazing! Its really awesome article, I have got much clear idea regarding from this paragraph.|
I've learn some good stuff
I've learn some good stuff here. Definitely price
bookmarking for revisiting. I wonder how much effort you put to create
one of these excellent informative web site.
Hi, I do believe this is a
Hi, I do believe this is a great blog. I stumbledupon it ;) I am going to come back yet again since I bookmarked it. Money and freedom is the greatest way to change, may you be rich and continue to guide other people.|
Hi there to every body, it's
Hi there to every body, it's my first pay a quick visit
of this weblog; this blog includes awesome and
in fact excellent stuff in favor of visitors.
Really no matter if someone
Really no matter if someone doesn't understand after that its up to other users that they will assist, so here it happens.|
After looking into a handful
After looking into a handful of the blog posts on your site, I truly appreciate
your technique of writing a blog. I bookmarked it to my bookmark site
list and will be checking back soon. Please visit my web site too and let me know your
opinion.
My spouse and I stumbled over
My spouse and I stumbled over here coming from a different web page and thought I should check things out. I like what I see so now i am following you. Look forward to going over your web page repeatedly.|
My brother recommended I may
My brother recommended I may like this web site. He used to be totally right.
This submit truly made my day. You can not imagine simply how much time I had
spent for this information! Thank you!
Your method of explaining the
Your method of explaining the whole thing in this post is genuinely fastidious, every one can effortlessly know it, Thanks a lot.|
You can certainly see your
You can certainly see your expertise in the article you write.
The sector hopes for more passionate writers such as you who are not afraid to say how they believe.
At all times follow your heart.
Hey! I understand this is
Hey! I understand this is kind of off-topic but I had to ask. Does building a well-established blog like yours take a lot of work? I'm brand new to running a blog however I do write in my journal daily. I'd like to start a blog so I will be able to share my personal experience and feelings online. Please let me know if you have any kind of suggestions or tips for brand new aspiring blog owners. Appreciate it!|
With havin so much written
With havin so much written content do you ever run into any problems of plagorism or copyright violation?
My site has a lot of unique content I've either created myself or outsourced but it
looks like a lot of it is popping it up all over the web without my permission. Do you know any
solutions to help prevent content from being stolen? I'd truly appreciate it.
I seriously love your site..
I seriously love your site.. Great colors & theme. Did you develop this amazing site yourself?
Please reply back as I'm hoping to create my
own website and want to know where you got this
from or what the theme is named. Thanks!
I like what you guys are
I like what you guys are usually up too. This type of clever work
and exposure! Keep up the very good works guys I've added you guys to blogroll.
Hozzászólás