Displaying 5 results from an estimated 5 matches for "new_rat".
Did you mean:
new_rate
2007 Jun 01
0
rspec_on_rails, could someone provide an example of using mocks/stubs?
...e point is to isolate the code being
tested and remove external dependencies, but I''m not sure how to implement
it. Can someone suggest how they would spec the code below:
I have a Book model and Review model
class Book < ActiveRecord::Base
has_many :reviews
def update_rating
new_rating = 0.0
unless reviews.empty?
reviews.each {|r| new_rating += r.rating}
new_rating /= review.size
end
update_attribute(:rating, new_rating)
end
end
The review class is just a standard model with a :rating attribute. Here''s
the (empty) spec i came up with:
desc...
2019 Apr 24
0
[nbdkit PATCH 4/4] filters: Check for mutex failures
...utex_unlock (&lock);
h->id = 0;
return h;
}
diff --git a/filters/rate/rate.c b/filters/rate/rate.c
index 978cdc3..cf03541 100644
--- a/filters/rate/rate.c
+++ b/filters/rate/rate.c
@@ -222,9 +222,8 @@ maybe_adjust (const char *file, struct bucket *bucket, pthread_mutex_t *lock)
if (new_rate == -1)
return;
- pthread_mutex_lock (lock);
+ ACQUIRE_LOCK_FOR_CURRENT_SCOPE (lock);
old_rate = bucket_adjust_rate (bucket, new_rate);
- pthread_mutex_unlock (lock);
if (old_rate != new_rate)
nbdkit_debug ("rate adjusted from %" PRIu64 " to %" PRIi64,
@@ -2...
2019 Apr 24
7
[nbdkit PATCH 0/4] More mutex sanity checking
I do have a question about whether patch 2 is right, or whether I've
exposed a bigger problem in the truncate (and possibly other) filter,
but the rest seem fairly straightforward.
Eric Blake (4):
server: Check for pthread lock failures
truncate: Factor out reading real_size under mutex
plugins: Check for mutex failures
filters: Check for mutex failures
filters/cache/cache.c
2019 Jul 31
13
[nbdkit PATCH 0/8] fd leak safety
There's enough here to need a review; some of it probably needs
backporting to stable-1.12.
This probably breaks tests on Haiku or other platforms that have not
been as on-the-ball about atomic CLOEXEC; feel free to report issues
that arise, and I'll help come up with workarounds (even if we end up
leaving a rare fd leak on less-capable systems).
Meanwhile, I'm still working on my
2019 Aug 02
23
[nbdkit PATCH v2 00/17] fd leak safety
This is a major rewrite compared to my v1 series, where I've tried
a lot harder to ensure that we still accommodate building on Haiku
(although I have not actually yet fired up a Haiku VM to try it
for myself). I also managed to make the sh plugin fully parallel,
on capable platforms.
See also my question on patch 10 on whether I've picked the best
naming convention.
Eric Blake (17):