… | |
… | |
306 | # I love transactions |
306 | # I love transactions |
307 | for (1..100) { |
307 | for (1..100) { |
308 | my $txn = $CFClient::DB_ENV->txn_begin; |
308 | my $txn = $CFClient::DB_ENV->txn_begin; |
309 | my $status = $self->{facemap}->db_get (id => $id); |
309 | my $status = $self->{facemap}->db_get (id => $id); |
310 | if ($status == 0 || $status == BerkeleyDB::DB_NOTFOUND) { |
310 | if ($status == 0 || $status == BerkeleyDB::DB_NOTFOUND) { |
311 | $id = ($id || 16) + 1; |
311 | $id = ($id || 64) + 1; |
312 | if ($self->{facemap}->put (id => $id) == 0 |
312 | if ($self->{facemap}->put (id => $id) == 0 |
313 | && $self->{facemap}->put ($hash => $id) == 0) { |
313 | && $self->{facemap}->put ($hash => $id) == 0) { |
314 | $txn->txn_commit; |
314 | $txn->txn_commit; |
315 | |
315 | |
316 | goto gotid; |
316 | goto gotid; |