Commit 28eb8873 authored by Brandon Walts's avatar Brandon Walts
Browse files

Merge branch 'version/2.4' into version/2.5

* version/2.4:
  Don't attempt removing objects that haven't been stored
  Somehow, only 9.6 seconds seem to elapse on Travis when sleeping 10 seconds
  Simplified the Runnable: no need to check for the overhead, checking that it slept 10 seconds suffices
parents bd322a8f 5dee1566
......@@ -414,6 +414,9 @@ sub remove { # remove the object by primary_key
my $self = shift @_;
my $object = shift @_;
# the object hasn't actually been stored yet / in this database
return if(UNIVERSAL::can($object, 'adaptor') and (!$object->adaptor or $object->adaptor != $self));
my $primary_key_constraint = $self->primary_key_constraint( $self->slicer($object, $self->primary_key()) );
return $self->remove_all( $primary_key_constraint );
......
......@@ -28,24 +28,18 @@ use Time::HiRes qw(time);
use Bio::EnsEMBL::Hive::Utils::Test qw(standaloneJob);
my $min_overhead;
for (1..10) {
my $t = time();
standaloneJob('Bio::EnsEMBL::Hive::RunnableDB::Dummy', {
'take_time' => 0,
});
my $d = time() - $t;
$min_overhead = $d if (not defined $min_overhead) || ($d < $min_overhead);
}
my $wait = 10;
my $t = time();
standaloneJob('Bio::EnsEMBL::Hive::RunnableDB::Dummy', {
'take_time' => $wait,
});
my $d = time() - $t;
# We allow the runnable to be 5 times faster than the fastest attempt so far
cmp_ok($d, '>=', $wait+$min_overhead/5, 'The "take_time" parameter made the runnable sleep a bit');
# Correct for Travis' built-in time machine
if ($ENV{'TRAVIS'}) {
$wait -= 1;
}
cmp_ok($d, '>=', $wait, 'The "take_time" parameter made the runnable sleep');
done_testing();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment