Recently for my Andriod app, I thought of giving GAE a try. The app was on Firebase, the only "Server" I needed was to send a push notifications (Downstream). So, I just went "Google Cloud Module" wizard with "Endpoints" option on Android Studio.
And created this simple servlet.
/ * An endpoint class we are exposing / @Api( name = "pushApi", version = "v3", namespace = @ApiNamespace( ownerDomain = "com.example.sample", ownerName = "com.example.sample", packagePath = "" ) )
public class MyEndpoint {
PushBean response = new PushBean();
/**
* A simple endpoint method that takes a name and says Hi back
*/
@ApiMethod(name = "pushToTopic")
public PushBean toTopic(@Named("topic") String topic, @Named("dataJson") String dataJson) {
try{
response.messageTopic(topic,dataJson);
return response;
}catch(Exception e){
return null;
}
}
}And deployed this on my backend. After 1 month of running in staging (I hadn't published the app yet and I would have called the end point around 1000 times), I got a bill of around $450. It said I had consumed around 8600+ hours of GAE instance. I almost fell of my chair when I saw that. Even if my instance ran all through the month, it could have only cost 720 hours.
I am just wondering what happened. What am I missing here? Did I do anything stupid? Can someone help me?