summaryrefslogtreecommitdiff
path: root/main/cdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/cdr.c')
-rw-r--r--main/cdr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main/cdr.c b/main/cdr.c
index 44cf1c3d2..416895de5 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -1424,11 +1424,13 @@ void ast_cdr_detach(struct ast_cdr *cdr)
newtail->cdr = cdr;
batch->tail = newtail;
curr = batch->size++;
- ast_mutex_unlock(&cdr_batch_lock);
/* if we have enough stuff to post, then do it */
- if (curr >= (batchsize - 1))
+ if (curr >= (batchsize - 1)) {
submit_unscheduled_batch();
+ }
+
+ ast_mutex_unlock(&cdr_batch_lock);
}
static void *do_cdr(void *data)