The operation of many real-world systems, e.g., servers of data centers, is accompanied by the heating of a server. Correspondingly, certain cooling mechanisms are used. If the server becomes overheated, it interrupts processing of customers and needs to be cooled. A customer is lost when its service is interrupted. To prevent overheating and reduce the customer loss probability, we suggest temporal termination of service of new customers when the temperature of the server reaches the predefined threshold value. Service is resumed after the temperature drops below another threshold value. The problem of optimal choice of the thresholds (with respect to the chosen economical criterion) is numerically solved under quite general assumptions about the parameters of the system (Markovian arrival process, phase-type distribution of service time, and accounting for customers impatience). Numerical examples are presented.