Last active
          December 12, 2024 12:48 
        
      - 
      
- 
        Save decentral1se/dff0a1f0b18299226643f60c91ef7987 to your computer and use it in GitHub Desktop. 
    incus listener add handler
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // ... | |
| listener, err := conn.GetEventsAllProjects() | |
| _, err = listener.AddHandler( | |
| []string{ | |
| api.EventLifecycleInstanceCreated, | |
| api.EventLifecycleInstanceReady, | |
| api.EventLifecycleInstanceRestarted, | |
| }, func(event api.Event) { | |
| ctx.Logger().Debug("handling instance create event", zap.Any("event", event)) | |
| err := u.provisionCandidates(ctx, conn) | |
| if err != nil { | |
| ctx.Logger().Error("unable to provision candidates", zap.Error(err)) | |
| } | |
| }) | |
| // ... | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment