A method for optimizing the scheduling of files to be sent to an application server (AS) at regular time intervals, comprising the following steps in a control device (CD): retrieving (S1) a first set of files from a database for a time interval, the first set of files being stored in a priority queue and carrying information sent from sensors linked to industrial machines, applying (S2) the retrieved first set of files to a scheduling algorithm using a compression ratio and combined with a reinforcement learning in order to select a second set of files, wherein the scheduling algorithm takes as input the first set of files, the compression ratio and the size limit and provides as output the second set of files, wherein the size of the second set of files divided by the compression ratio is less than the size limit, compressing (S3) the second set of files based on the compression ratio into a compressed file, wherein the size of the compressed file is below a size limit, sending (S4) the compressed file to the application server, wherein the compression ratio is updated based on the size of the second set of files and the size of the compressed file, wherein the reinforcement learning uses the size of a previous compressed file from a previous time interval wherein the scheduling algorithm provides an intermediary set of files that is used by a set of arms that use more or less files than the intermediary set of files and one arm is selected according to Upper Confidence Bound and corresponds to the second set of files, wherein the sum of the weights of files of the intermediary set of files divided by the compression ratio is under the size limit, wherein the reinforcement learning is done by exploration by reduction or by augmentation of the intermediary set of files, wherein a learning phase is used for the set of arms, taking as feedback the size of the previous compressed file sent to the application server. retrieving (S1) a first set of files from a database for a time interval, the first set of files being stored in a priority queue and carrying information sent from sensors linked to industrial machines, applying (S2) the retrieved first set of files to a scheduling algorithm using a compression ratio and combined with a reinforcement learning in order to select a second set of files, wherein the scheduling algorithm takes as input the first set of files, the compression ratio and the size limit and provides as output the second set of files, wherein the size of the second set of files divided by the compression ratio is less than the size limit, compressing (S3) the second set of files based on the compression ratio into a compressed file, wherein the size of the compressed file is below a size limit, sending (S4) the compressed file to the application server, wherein the compression ratio is updated based on the size of the second set of files and the size of the compressed file, wherein the reinforcement learning uses the size of a previous compressed file from a previous time interval wherein the scheduling algorithm provides an intermediary set of files that is used by a set of arms that use more or less files than the intermediary set of files and one arm is selected according to Upper Confidence Bound and corresponds to the second set of files, wherein the sum of the weights of files of the intermediary set of files divided by the compression ratio is under the size limit, wherein the reinforcement learning is done by exploration by reduction or by augmentation of the intermediary set of files, wherein a learning phase is used for the set of arms, taking as feedback the size of the previous compressed file sent to the application server. <EOS>