File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -217,9 +217,6 @@ func (a *Alerts) Get(fp model.Fingerprint) (*types.Alert, error) {
217217
218218// Put adds the given alert to the set. 
219219func  (a  * Alerts ) Put (alerts  ... * types.Alert ) error  {
220- 	a .mtx .Lock ()
221- 	defer  a .mtx .Unlock ()
222- 
223220	for  _ , alert  :=  range  alerts  {
224221		fp  :=  alert .Fingerprint ()
225222
@@ -249,22 +246,22 @@ func (a *Alerts) Put(alerts ...*types.Alert) error {
249246
250247		a .callback .PostStore (alert , existing )
251248
249+ 		a .mtx .Lock ()
252250		for  _ , l  :=  range  a .listeners  {
253251			select  {
254252			case  l .alerts  <-  alert :
255253			case  <- l .done :
256254			}
257255		}
256+ 		a .mtx .Unlock ()
257+ 
258258	}
259259
260260	return  nil 
261261}
262262
263263// count returns the number of non-resolved alerts we currently have stored filtered by the provided state. 
264264func  (a  * Alerts ) count (state  types.AlertState ) int  {
265- 	a .mtx .Lock ()
266- 	defer  a .mtx .Unlock ()
267- 
268265	var  count  int 
269266	for  _ , alert  :=  range  a .alerts .List () {
270267		if  alert .Resolved () {
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments