fix: msgbus get handler
This commit is contained in:
		
							parent
							
								
									5458d35be0
								
							
						
					
					
						commit
						6033437584
					
				
							
								
								
									
										3
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								main.go
									
									
									
									
									
								
							@ -49,6 +49,7 @@ func main() {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
func run(ctx context.Context) error {
 | 
			
		||||
	ctx, span := logz.Span(ctx)
 | 
			
		||||
	diskstore.Init(ctx)
 | 
			
		||||
	memstore.Init(ctx)
 | 
			
		||||
	if err := domain.Init(ctx); err != nil {
 | 
			
		||||
@ -98,6 +99,8 @@ func run(ctx context.Context) error {
 | 
			
		||||
		return s.Shutdown(ctx)
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	span.End()
 | 
			
		||||
 | 
			
		||||
	return g.Wait()
 | 
			
		||||
}
 | 
			
		||||
func env(name, defaultValue string) string {
 | 
			
		||||
 | 
			
		||||
@ -83,10 +83,13 @@ func (s *service) get(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
		first = lis[0]
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var pos, count int64 = -1, -99
 | 
			
		||||
	var pos, count int64 = 0, es.AllEvents
 | 
			
		||||
	qry := r.URL.Query()
 | 
			
		||||
 | 
			
		||||
	if i, err := strconv.ParseInt(qry.Get("index"), 10, 64); err == nil {
 | 
			
		||||
	if i, err := strconv.ParseInt(qry.Get("index"), 10, 64); err == nil && i > 1 {
 | 
			
		||||
		pos = i - 1
 | 
			
		||||
	}
 | 
			
		||||
	if i, err := strconv.ParseInt(qry.Get("pos"), 10, 64); err == nil {
 | 
			
		||||
		pos = i
 | 
			
		||||
	}
 | 
			
		||||
	if i, err := strconv.ParseInt(qry.Get("n"), 10, 64); err == nil {
 | 
			
		||||
@ -236,10 +239,10 @@ func (s *service) websocket(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
		first = lis[0]
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var pos int64 = -1
 | 
			
		||||
	var pos int64 = 0
 | 
			
		||||
	qry := r.URL.Query()
 | 
			
		||||
 | 
			
		||||
	if i, err := strconv.ParseInt(qry.Get("index"), 10, 64); err == nil {
 | 
			
		||||
	if i, err := strconv.ParseInt(qry.Get("index"), 10, 64); err == nil && i > 0 {
 | 
			
		||||
		pos = i - 1
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user