By sakiland on
I write module for Penny auctions (similar to swoopo.com). Many things are finished, but I have problem with bid butlers (more details).
I has made one function that scanned all auctions and bid butlers in relation with that auctions. I need to run that function in background, because it will sleep when it has nothing to do. Something like
function function_name() {
// Array with control signals.
$bid_butlers = get_bid_butles();
// Variable that save time of end of auction that will be first end.
$first_end_time = get_first_end_time();
while(true) {
$signals = get_signals();
if($signals['exit'] === TRUE) {
break;
}
if($signals['rescan'] === TRUE) {
// Rescan database for new auctions or bid butlers.
$bid_butlers = get_bid_butles();
$first_end_time = get_first_end_time();
}
if($first_end_time - time() < 10) {
// Then start to place bids for auctions that have less than 10s to the end.
}
sleep(1);
}
}
I don't know how to start that function in background. Maybe start function via cron will be solution, but I can't execute that function every second.
Comments
cron
I think you should use cron indeed.
A single function would handle all the bids on all auctions for all users.
The very first lines should check whether there is something to be done.
If nothing's going on, return immediately without further actions.
You can only run cron once
You can only run cron once every minute.
I didn't read any of your links, and I've only read what's posted in this thread. But you could set a script to run on every page load for every user by using hook_init(). This script could do whatever it is you want done. But it could be particularly resource intensive depending on what you are trying to do.
Contact me to contract me for D7 -> D10/11 migrations.
Like robots
Bid butler is like robot. It place bid instead of user when time to the end of auction is under 10s. So, that can happen more times within one minute. That's problem with cron.
Hook_init() can be a solution, but then I must have history log for all bids that happened from last user page load (and that can be many, many bids).
Run via cron
OK. I will use script that will ran via cron every minute. If previous script is still running, than this script will exit.
Now, problem is how to make connection to database, because this script doesn't have any connection to the drupal. Do I must create connection to the database manually or I can include some file (like database.inc or bootstrap.inc, I don't know). I need functions: db_query() and db_fetch_array().
Partial bootstrap
With your script in the drupal root, you can do a partial bootstrap of Drupal, up to the point when the DB functions are available:
Thank you
That's all I need. Thank you very much, it works :)
Sharing??
Hi
Can you share your module?
Yes, I will share. I must
Yes, I will share. I must finish some things, but I think that it will be finish to 15th November.
That would be perfect!
That would be perfect!
Is it done?
Is it done and will it work with Drupal 7?
Within a few days I will
Within a few days I will finish "penny auction" module for Drupal 6. I didn't test with Drupal 7. I think that there is one or two function that will not work in Drupal 7. I'm not sure, I'll try to make Drupal 7 version as soon as possible.
Within a few days
Perfect. Hope to try out the module soon :-)
Very interested
I am looking forward to your module, I am searching for a good auction module that works with drupal
Wishing you the best and good luck,
kind regards,
Sjoerd
any idea when this will be
any idea when this will be released? I'm keen to test this out...
I hope this week. I'm working
I hope this week. I'm working one project (that is my priority) and I hope that will be finish this week.
Any news
Any news?
Anyone looking for a drupal
Anyone looking for a drupal powered penny auction script please have a look with what I've done with http://biddini.com. Has a working bidbutler functionality as well.
Penny auction module
Was your Penny auction module ever meant to happen?
Yes, it will. But I'll first
Yes, it will. But I'll first must adjust code like Drupal's standards. I can't publish code in this format. This is my first module that I plan to publish, so I don't have much experience.
topic about ....
Maybe drupal community would like to help you with format your code, I think here is a lot of people interested about your solution :-)
Can I create a new cvs
Can I create a new cvs project, even if I hasn't completed all standards. I read http://drupal.org/node/100748, and I don't have documentation. I really want to commit code, but I need help about how to do that. Sorry, I don't have experience in this :(.
another nice script
Hi, another nice script or solution base on drupal is auctionking
Auctionking
Auctionking - looks like Drupal, but what is underneath? Anyone know which auction module is used?
Re: Auctionking
It is Drupal 5.19, 2009-07-01, ubercart-1-7... look at the source code of the page ;-)
another info http://www.drupalsites.net/weblink/auction-king
Marinex
Still no
Still no Penny auction module. Will it ever be released?
Hi, is your project still
Hi, is your project still alive?
thank you for your answer.
Is there a way to test this
Is there a way to test this mod out?
Hi, auctionking is 404,
Hi,
auctionking is 404, biddini is 404. Why is this?
Is there somewhere a cents-auction drupal 7 (or drupal 6) module?
If not would somebody be willing to build it and preferrably integrated with commerce: http://drupal.org/project/commerce_auction
Thanks for your reply in advance!
Greetings, Martijn