A compressor, comprising: a cooling line fluidly connected to a refrigerant source, a motor housing, at least one bearing located within the motor housing, a compressor motor located within the motor housing, a metering device fluidly connected to the cooling line and the motor housing, and configured to provide a portion of a baseline flow of refrigerant and a variable flow of refrigerant from the refrigerant source to the motor housing, the metering device including a valve; a shaft seal; and a controller configured to: receive compressor operational parameter data including one or more of a temperature within the motor housing, a pressure within the motor housing, and a gas density within the motor housing; and determine a position of the valve based on the received compressor operational parameter data, characterized in that: the refrigerant source is a volute housing of the compressor and the cooling line directly connects the volute housing to the metering device another portion of the baseline flow of refrigerant is provided into the motor housing via leakage at the shaft seal; the valve is an automated expansion valve; the metering device comprises a valve seat opening which is configured to allow flow past the valve even when the valve is fully extended, wherein the valve seat opening is formed in a valve seat of the valve; the variable flow of refrigerant from the metering device and the baseline flow are configured to be combined into a cooling flow and when the compressor is in operation the cooling flow is directed to travel in a direction of rotation of an internal component within the compressor motor housing. a cooling line fluidly connected to a refrigerant source, a motor housing, at least one bearing located within the motor housing, a compressor motor located within the motor housing, a metering device fluidly connected to the cooling line and the motor housing, and configured to provide a portion of a baseline flow of refrigerant and a variable flow of refrigerant from the refrigerant source to the motor housing, the metering device including a valve; a shaft seal; and a controller configured to: receive compressor operational parameter data including one or more of a temperature within the motor housing, a pressure within the motor housing, and a gas density within the motor housing; and determine a position of the valve based on the received compressor operational parameter data, characterized in that: the refrigerant source is a volute housing of the compressor and the cooling line directly connects the volute housing to the metering device another portion of the baseline flow of refrigerant is provided into the motor housing via leakage at the shaft seal; the valve is an automated expansion valve; the metering device comprises a valve seat opening which is configured to allow flow past the valve even when the valve is fully extended, wherein the valve seat opening is formed in a valve seat of the valve; the variable flow of refrigerant from the metering device and the baseline flow are configured to be combined into a cooling flow and when the compressor is in operation the cooling flow is directed to travel in a direction of rotation of an internal component within the compressor motor housing. receive compressor operational parameter data including one or more of a temperature within the motor housing, a pressure within the motor housing, and a gas density within the motor housing; and determine a position of the valve based on the received compressor operational parameter data, characterized in that: the refrigerant source is a volute housing of the compressor and the cooling line directly connects the volute housing to the metering device another portion of the baseline flow of refrigerant is provided into the motor housing via leakage at the shaft seal; the valve is an automated expansion valve; the metering device comprises a valve seat opening which is configured to allow flow past the valve even when the valve is fully extended, wherein the valve seat opening is formed in a valve seat of the valve; the variable flow of refrigerant from the metering device and the baseline flow are configured to be combined into a cooling flow and when the compressor is in operation the cooling flow is directed to travel in a direction of rotation of an internal component within the compressor motor housing. the refrigerant source is a volute housing of the compressor and the cooling line directly connects the volute housing to the metering device another portion of the baseline flow of refrigerant is provided into the motor housing via leakage at the shaft seal; the valve is an automated expansion valve; the metering device comprises a valve seat opening which is configured to allow flow past the valve even when the valve is fully extended, wherein the valve seat opening is formed in a valve seat of the valve; the variable flow of refrigerant from the metering device and the baseline flow are configured to be combined into a cooling flow and when the compressor is in operation the cooling flow is directed to travel in a direction of rotation of an internal component within the compressor motor housing.