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

The collection has been marked as complete with regards to additions. #919

Open
Franco-Vera opened this issue Jun 30, 2020 · 1 comment
Open

Comments

@Franco-Vera
Copy link

Franco-Vera commented Jun 30, 2020

hi,

Pusharp version 4.0.10
About 10% of daily push notifications are getting this error. until now i think is aleatory...

context: this is a webservices than just send 1 notification for every call. and for the same device sometimes works and sometimes fails.

Mensaje: The collection has been marked as complete with regards to additions.
StackTrace: at System.Collections.Concurrent.BlockingCollection1.TryAddWithNoTimeValidation(T item, Int32 millisecondsTimeout, CancellationToken cancellationToken) at PushSharp.Core.ServiceBroker1.QueueNotification(TNotification notification)
at Connection_Push

By doing many tests I was able to verify that the error occurs when I run the service many times in a very short time.

For example, running the service every one second is no problem, but 10 times in one second the error is generated.

any suggestion?

MY CODE

                       GcmConfiguration config = new GcmConfiguration(fcmkey);
                        config.GcmUrl = GoogleFCM;

                        fcmBroker = new GcmServiceBroker(config);
                        fcmBroker.Start();

                        fcmBroker.OnNotificationFailed += (notification, aggregateEx) =>
                        {
                            aggregateEx.Handle(ex =>
                            { 
                                status.status = "ERROR SENDING PUSH";
                                status.description = ex.Message;
                                return true;
                            });
                        };
                        fcmBroker.OnNotificationSucceeded += (notification) =>
                        {
                            status.status = "Success";
                            status.description = "Send proccess finished";
                        };

                        while (fcmBroker.IsCompleted) { } //my desesperation but not working

                        fcmBroker.QueueNotification(new GcmNotification
                        {
                            RegistrationIds = new List<string> { _dr[0].ToString() },
                            Data = JObject.Parse(jsonconv)
                        });

                        fcmBroker.Stop();
@Franco-Vera
Copy link
Author

finally found the problem

fcmbroker was created as static variable. Changing this the problem go out,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant