Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPBUGS-11137: Add configmap to store subscriber info as a storage type - To prevent loss of subscribers #63

Merged
merged 1 commit into from
Apr 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,25 @@ func (s *Server) createPublisher(w http.ResponseWriter, r *http.Request) {
func (s *Server) sendOut(eType channel.Type, sub *pubsub.PubSub) {
// go ahead and create QDR to this address
s.dataOut <- &channel.DataChan{
ID: sub.GetID(),
Address: sub.GetResource(),
Data: &ce.Event{},
Type: eType,
Status: channel.NEW,
}
}

func (s *Server) sendOutToDelete(eType channel.Type, sub *pubsub.PubSub) {
// go ahead and create QDR to this address
s.dataOut <- &channel.DataChan{
ID: sub.GetID(),
Address: sub.GetResource(),
Data: &ce.Event{},
Type: eType,
Status: channel.DELETE,
}
}

func (s *Server) getSubscriptionByID(w http.ResponseWriter, r *http.Request) {
queries := mux.Vars(r)
subscriptionID, ok := queries["subscriptionid"]
Expand Down Expand Up @@ -257,6 +269,8 @@ func (s *Server) deleteAllSubscriptions(w http.ResponseWriter, r *http.Request)
if size > 0 {
localmetrics.UpdateSubscriptionCount(localmetrics.ACTIVE, -(size))
}
// go ahead and create QDR to this address
s.sendOutToDelete(channel.SUBSCRIBER, &pubsub.PubSub{ID: "", Resource: "delete-all-subscriptions"})
respondWithMessage(w, http.StatusOK, "deleted all subscriptions")
}

Expand Down