<commit_before>package org.openforis.sepal.component.budget.command

import org.openforis.sepal.command.AbstractCommand
import org.openforis.sepal.command.CommandHandler
import org.openforis.sepal.component.budget.internal.StorageUseService
import org.openforis.sepal.user.UserRepository
import org.openforis.sepal.util.annotation.Data

@Data(callSuper = true)
class DetermineUserStorageUsage extends AbstractCommand<Void> {
}

class DetermineUserStorageUsageHandler implements CommandHandler<Void, DetermineUserStorageUsage> {
    private final StorageUseService storageUseService
    private final UserRepository userRepository

    DetermineUserStorageUsageHandler(StorageUseService storageUseService, UserRepository userRepository) {
        this.storageUseService = storageUseService
        this.userRepository = userRepository
    }

    Void execute(DetermineUserStorageUsage command) {
        userRepository.eachUsername {
            storageUseService.updateStorageUseForThisMonth(it)
        }

        return null
    }

}<commit_msg>Added logging to storage usage checks.<commit_after>package org.openforis.sepal.component.budget.command

import org.openforis.sepal.command.AbstractCommand
import org.openforis.sepal.command.CommandHandler
import org.openforis.sepal.component.budget.internal.StorageUseService
import org.openforis.sepal.user.UserRepository
import org.openforis.sepal.util.annotation.Data
import org.slf4j.LoggerFactory

@Data(callSuper = true)
class DetermineUserStorageUsage extends AbstractCommand<Void> {
}

class DetermineUserStorageUsageHandler implements CommandHandler<Void, DetermineUserStorageUsage> {
    private static final LOG = LoggerFactory.getLogger(this)
    private final StorageUseService storageUseService
    private final UserRepository userRepository

    DetermineUserStorageUsageHandler(StorageUseService storageUseService, UserRepository userRepository) {
        this.storageUseService = storageUseService
        this.userRepository = userRepository
    }

    Void execute(DetermineUserStorageUsage command) {
        userRepository.eachUsername {
            long startTime = System.currentTimeMillis()
            def storageUse = storageUseService.updateStorageUseForThisMonth(it)
            LOG.debug([command: command, username: it, storageUse: storageUse,
                       duration: (System.currentTimeMillis() - startTime) / 1000 + 's'] as String)
        }
        return null
    }

}
{'fraction_non_alphanumeric': 0.0650142218610321, 'fraction_numerical': 0.0020316944331572532, 'mean_word_length': 4.570135746606335, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6352052', 'n_tokens_mistral': 638, 'n_tokens_neox': 622, 'n_words': 122}